How Checkout Pricing Works (Shopify Functions)
This guide explains how Qivra B2B Wholesale applies your price list discounts at checkout using a Shopify Function, and how it stays in sync with the prices customers see on the storefront.
Two pricing layers, one source of truth
Section titled “Two pricing layers, one source of truth”Qivra B2B Wholesale runs in two places so that what a customer sees is exactly what they pay:
| Layer | Where | What it does |
|---|---|---|
| Storefront | Product/collection/cart pages | Rewrites displayed prices in real time |
| Checkout | Shopify checkout | Applies the actual discount to the order |
Both layers read the same shop metafield compiled from your price lists, so there is never a mismatch between display and checkout.
The checkout Shopify Function
Section titled “The checkout Shopify Function”At checkout, a cart lines discount Shopify Function runs. It:
- Reads the price-list rules from the shop metafield.
- For each cart line, finds the matching price list (customer + market + product match, highest priority).
- Applies the resolved discount — a fixed amount or percentage off.
What the Function honors at checkout
Section titled “What the Function honors at checkout”- Customer selection — all / logged-in / guest / by tag / specific.
- Market selection — all / specific.
- Product selection — all / collection / tag / specific variant.
- Per-variant overrides — a fixed price wins absolutely; per-variant discount or price breaks replace the list rule for that variant.
- Priority — the highest-priority matching list wins.
What the Function skips at checkout
Section titled “What the Function skips at checkout”- Percentage increase price breaks — Shopify checkout cannot add surcharges, so markup tiers are display-only and do not increase the price at checkout. See Pricing rules.
Why both layers matter
Section titled “Why both layers matter”If the app only changed display prices, a customer could see a discount but pay full price at checkout (or vice versa). By running the same logic at checkout via a Shopify Function, the final total always reflects your B2B rules.
Keeping checkout up to date
Section titled “Keeping checkout up to date”The checkout Function reads the metafield that the Metafield sync panel maintains. When you save or schedule a price list, the metafield is updated and the Function picks up the new rules on the next checkout.
If checkout discounts ever look stale:
- Confirm the sync status is Up to date.
- Run Refresh all prices from the Advanced panel.
- See Troubleshooting: B2B prices not showing.
Related docs
Section titled “Related docs”- Create your first price list
- Pricing rules: discounts and price breaks
- Metafield sync status
- Enable the app embed