Extend PunchOut B2B pricing to your Shopify cart page so enterprise buyers see their negotiated prices throughout the entire shopping journey — from product pages through to checkout.
The cart pricing script automatically detects the buyer's fromIdentity session, resolves their customer pricing, and updates cart prices in real time. It works with Shopify's Dawn theme out of the box and supports custom themes through configurable CSS selectors.
Note:
Prerequisite: The PunchOut tracker script must already be installed and working on your store before setting up cart pricing. The tracker captures the fromIdentity parameter that the cart pricing script relies on.
How It Works
Buyer Arrives via PunchOut
The enterprise buyer clicks through from their procurement system (SAP Ariba, Coupa, etc.). The existing tracker script captures their fromIdentity and stores it in the browser session.
Buyer Navigates to Cart
When the buyer opens the cart page, the cart pricing script automatically detects the active fromIdentity session.
B2B Prices Are Fetched
The script resolves the buyer's identity to their Shopify customer record and fetches their negotiated pricing for all items in the cart.
Cart Prices Update
Unit prices, line totals, and the cart subtotal are updated to reflect the buyer's B2B rates. Optionally, the original prices are shown with a strikethrough for comparison.
PunchOut Cloud Receives Correct Prices
The pricing data is made available to PunchOut Cloud so the correct B2B prices transfer back to the procurement system at checkout.
Installation
Add the cart pricing script to your Shopify cart page template.
Open Theme Editor
In your Shopify admin, go to Online Store → Themes → Edit code.
Locate Your Cart Template
Find the cart template file. Depending on your theme, this is typically one of:
templates/cart.liquidsections/main-cart-items.liquidsections/cart-template.liquid
Add the Cart Pricing Script
Add the following script tag near the bottom of your cart template, before the closing tag:
<!-- Weevio Cart B2B Pricing -->
<script src="https://cloud.weevio.co/ecommerce-widget/cartBssPricing.js" defer="defer"></script>
Add Configuration (Optional)
If you need to customize the behavior, add a configuration block before the script tag:
<script>
window.weevioWidgetConfig = {
shopifyDomain: '{{ shop.permanent_domain }}',
teamID: 'YOUR_TEAM_ID',
baseURL: 'https://cloud.weevio.co',
cartBssPricing: {
enableDomUpdates: true
}
};
</script>
<!-- Weevio Cart B2B Pricing -->
<script src="https://cloud.weevio.co/ecommerce-widget/cartBssPricing.js" defer="defer"></script>
Note:
If you already have a window.weevioWidgetConfig block on the page (for example, from the product page widget), add the cartBssPricing property to the existing configuration rather than creating a second block.
Save and Test
Save your theme changes. Visit your cart page with an active PunchOut session to verify pricing updates.
Configuration
Dawn Theme (Default)
For stores using Shopify's Dawn theme or most standard themes, the default settings work out of the box with no additional configuration:
window.weevioWidgetConfig = {
shopifyDomain: '{{ shop.permanent_domain }}',
teamID: 'YOUR_TEAM_ID',
baseURL: 'https://cloud.weevio.co',
cartBssPricing: {
enableDomUpdates: true
}
};
The script automatically detects Dawn's cart HTML structure and updates the correct price elements.
BSS B2B App Compatibility
If your store uses the BSS B2B app, the cart pricing script is fully compatible with no special configuration needed. The script automatically detects BSS B2B attributes in your theme:
bss-b2b-cart-item-key— Cart item identifiersbss-b2b-item-original-price— Unit price elementsbss-b2b-cart-total-price— Cart total elements
These attributes are prioritized over standard selectors, ensuring seamless integration with BSS-powered themes.
Custom Themes
For custom Shopify themes, you may need to specify CSS selectors that match your theme's cart HTML structure.
Inspect Your Cart Page
Open your cart page in a browser and use Developer Tools (F12) to inspect the HTML structure. Identify the CSS selectors for:
- The cart container (wraps all items)
- Individual cart item rows
- Unit price elements
- Line total elements
- The cart subtotal
Configure Custom Selectors
Add your theme's selectors to the configuration:
window.weevioWidgetConfig = {
shopifyDomain: '{{ shop.permanent_domain }}',
teamID: 'YOUR_TEAM_ID',
baseURL: 'https://cloud.weevio.co',
cartBssPricing: {
enableDomUpdates: true,
selectors: {
cartContainer: '#my-custom-cart',
cartItemRow: '.custom-cart-row',
cartItemPrice: '.custom-unit-price',
cartItemLinePrice: '.custom-line-total',
cartSubtotal: '#custom-subtotal',
variantIdAttribute: 'data-product-variant-id'
}
}
};
Selector reference:
| Selector | Description | Default |
|---|---|---|
cartContainer | Element wrapping all cart items | cart-items, .cart__items |
cartItemRow | Each individual cart line item | .cart-item, .cart__item |
cartItemPrice | Unit price display per item | .cart-item__price .price |
cartItemLinePrice | Line total (qty × price) | .cart-item__totals .price |
cartSubtotal | Cart subtotal element | .totals__subtotal-value |
variantIdAttribute | HTML attribute containing variant ID | data-variant-id |
Note:
Make sure your cart item rows include a data-cart-item-key or data-variant-id attribute so the script can match each row to the correct pricing data. Most Shopify themes include this by default.
Data-Only Mode
If you only need to pass B2B pricing data to PunchOut Cloud without visually updating the cart page, disable DOM updates:
cartBssPricing: {
enableDomUpdates: false
}
In this mode, the script still populates the pricing data that PunchOut Cloud reads at checkout, but the cart UI shows standard Shopify prices.
Price Formatting
Customize how B2B prices are displayed in the cart using the formatting options:
cartBssPricing: {
enableDomUpdates: true,
formatting: {
currencySymbol: '$',
currencyPosition: 'before',
decimalPlaces: 2,
thousandsSeparator: ',',
decimalSeparator: '.'
}
}
Formatting options:
| Option | Description | Default | Example |
|---|---|---|---|
currencySymbol | Currency symbol to display | $ | €, £, ¥ |
currencyPosition | Symbol placement | before | before → $19.99, after → 19.99€ |
decimalPlaces | Number of decimal digits | 2 | 0, 2, 3 |
thousandsSeparator | Thousands grouping character | , | , → 1,000 or . → 1.000 |
decimalSeparator | Decimal point character | . | . → 19.99 or , → 19,99 |
European store example (EUR):
cartBssPricing: {
enableDomUpdates: true,
formatting: {
currencySymbol: '€',
currencyPosition: 'after',
decimalSeparator: ',',
thousandsSeparator: '.'
}
}
This displays prices as 1.299,99€ instead of $1,299.99.
Visual Indicators
Show original prices alongside B2B prices using the indicators options:
cartBssPricing: {
enableDomUpdates: true,
indicators: {
showOriginalPrice: true,
modifiedPriceClass: 'b2b-price',
originalPriceClass: 'original-price'
}
}
When showOriginalPrice is enabled, each updated price element shows both the original retail price (with strikethrough styling) and the B2B price.
Add CSS to style the prices:
.original-price {
text-decoration: line-through;
opacity: 0.6;
margin-right: 0.5em;
}
.b2b-price {
font-weight: bold;
color: #007acc;
}
Indicator options:
| Option | Description | Default |
|---|---|---|
showOriginalPrice | Display original price with strikethrough | true |
modifiedPriceClass | CSS class applied to B2B price | weevio-b2b-price |
originalPriceClass | CSS class applied to original price | weevio-original-price |
Configuration Examples
Minimal Setup (Dawn Theme)
window.weevioWidgetConfig = {
shopifyDomain: '{{ shop.permanent_domain }}',
teamID: 'YOUR_TEAM_ID',
baseURL: 'https://cloud.weevio.co',
cartBssPricing: {
enableDomUpdates: true
}
};
Show Original Price with Strikethrough
window.weevioWidgetConfig = {
shopifyDomain: '{{ shop.permanent_domain }}',
teamID: 'YOUR_TEAM_ID',
baseURL: 'https://cloud.weevio.co',
cartBssPricing: {
enableDomUpdates: true,
indicators: {
showOriginalPrice: true,
modifiedPriceClass: 'b2b-price',
originalPriceClass: 'original-price'
}
}
};
European Store (EUR)
window.weevioWidgetConfig = {
shopifyDomain: '{{ shop.permanent_domain }}',
teamID: 'YOUR_TEAM_ID',
baseURL: 'https://cloud.weevio.co',
cartBssPricing: {
enableDomUpdates: true,
formatting: {
currencySymbol: '€',
currencyPosition: 'after',
decimalSeparator: ',',
thousandsSeparator: '.'
}
}
};
Custom Theme with Manual Selectors
window.weevioWidgetConfig = {
shopifyDomain: '{{ shop.permanent_domain }}',
teamID: 'YOUR_TEAM_ID',
baseURL: 'https://cloud.weevio.co',
cartBssPricing: {
enableDomUpdates: true,
selectors: {
cartContainer: '#my-custom-cart',
cartItemRow: '.custom-cart-row',
cartItemPrice: '.custom-unit-price',
cartItemLinePrice: '.custom-line-total',
cartSubtotal: '#custom-subtotal',
variantIdAttribute: 'data-product-variant-id'
}
}
};
Testing
Create a Test PunchOut Session
Open a test URL with a valid fromIdentity parameter:
https://your-store.com?fromIdentity=AN01631249352
Make sure the corresponding customer is tagged in Shopify and assigned to a B2B price list.
Add Items to Cart
Browse products and add items to the cart. The product page widget should already be showing B2B pricing if configured.
View Cart Page
Navigate to the cart. You should see:
- Unit prices updated to B2B rates
- Line totals recalculated
- Cart subtotal reflecting B2B pricing
- Original prices with strikethrough (if enabled)
Verify in Browser Console
Open developer tools (F12) and check the console:
// Verify pricing data is populated
console.log(window.BSS_B2B?.cart);
// Expected output:
// {
// modifiedItemsSubtotalPrice: 8999, (in cents)
// cpPricingList: Map { "key1" => { modifiedItemPrice: 4500, ... } }
// }
Note:
Debug mode: During development, add debug: true to your cartBssPricing configuration. This enables detailed console logging on localhost to help identify selector or pricing issues.
Troubleshooting
Prices Not Updating on Cart Page
Check the script is loaded:
- View page source and confirm the
cartBssPricing.jsscript tag is present - Check the browser console for 404 or loading errors
Check the PunchOut session is active:
// In browser console:
sessionStorage.getItem('weevio_fromIdentity')
// Should return the buyer's identity string
Check that pricing data was fetched:
// In browser console:
console.log(window.BSS_B2B?.cart);
// Should show pricing data, not undefined
If BSS_B2B.cart is undefined, the script may not have resolved the customer. Verify the customer tag and price list setup in Shopify.
Cart Items Not Matching Prices
If some cart items show B2B prices but others don't:
- Verify all products in the cart are included in the customer's B2B price list
- Check that cart item rows have a
data-cart-item-keyordata-variant-idattribute - For custom themes, ensure the
variantIdAttributeselector matches your theme's HTML
Selectors Not Working (Custom Themes)
If DOM updates aren't appearing:
- Open browser Developer Tools
- Use the Elements panel to inspect your cart's HTML
- Verify the CSS selectors in your configuration match the actual elements
- Try enabling
debug: trueon localhost for detailed logging
Cart Subtotal Not Updating
The subtotal selector may differ between themes. Common alternatives:
.totals__subtotal-value(Dawn).totals__total-value(some Dawn variants).cart__subtotal(older themes)
Update the cartSubtotal selector in your configuration to match your theme.
PunchOut Cloud Not Receiving B2B Prices
If PunchOut Cloud transfers standard prices instead of B2B prices:
- Ensure
enableDomUpdatesis not the issue — even with DOM updates disabled, the pricing data is still populated for PunchOut Cloud - Check that the cart pricing script loads before
punchout.min.js - Verify
window.BSS_B2B.cartcontains pricing data in the browser console
For additional help, see the PunchOut Commerce setup guide or the Widget Troubleshooting page.
Next Steps
Need Help?
For assistance, please send a message to our Support page.