Skip to content
Tutorials Center
My learning

Topics

Lesson 9 of 40 ยท Pricing, Promotions, Tax

Pricing Models

How online shops store and resolve prices: base and compare-at prices, price lists, volume and tiered pricing, B2B contracts, customer groups and schedules.

"What does this cost?" sounds like a single column in a products table. In a real shop it is a small question with a long answer: it depends on who is asking, how many they buy, which currency and market they are in, what day it is, and whether a sale is running. Shops that bolt these rules onto one price column end up with prices that nobody can explain.

This lesson shows a cleaner way to think about it. You will separate the catalog (what you sell) from price data (what it costs in a given context), learn the common price structures, and write a resolver that turns a context into one price. Discounts that apply at checkout, such as coupons, are a different layer, covered in Building a Promotions Engine. All amounts here are integers in minor units, as explained in Representing Money Correctly.

Base price and compare-at price

Every sellable SKU needs a base price: the normal price a typical customer pays. Many shops add a compare-at price (also called list price, RRP or "was" price) that is shown crossed out next to the base price to signal a deal.

Keep them conceptually apart:

  • The price is what the customer is charged.
  • The compare-at price is display information only. It never enters the totals.

If your cart calculation ever reads the compare-at field, a marketing change to a label will change what customers pay. Treat the compare-at value as presentation, and see the display rules at the end of this lesson for why it can also be a legal matter.

Price lists

The most flexible structure is the price list: a named set of prices, each row saying "SKU X costs N in this list". A product does not own the price; it appears in one or more lists.

Typical lists:

  • retail for everyone (the default)
  • wholesale or contract-acme for business customers
  • eu, uk, jp for markets with different currencies or tax display rules
  • black-friday-2026 for a scheduled campaign

A customer, a channel (web, POS, marketplace) or a market is assigned to a list. When the resolver cannot find a SKU in the assigned list, it falls back to a more general list, normally retail. This keeps lists small: a wholesale list only needs rows for SKUs that differ.

flowchart TD
    Q["Who? What? When?<br/>customer, SKU, qty, date"] --> L1{"SKU in customer's list<br/>valid today?"}
    L1 -->|"yes"| P["Use that price"]
    L1 -->|"no"| L2{"SKU in default list<br/>valid today?"}
    L2 -->|"yes"| P
    L2 -->|"no"| E["Error: not for sale"]
    P --> T["Apply quantity tiers"]

A resolver walks from the most specific price list to the most general one, then applies quantity rules.

Scheduled prices

Add starts_at and ends_at to a price row and a sale becomes data instead of a deployment. A scheduled row that covers today wins over the open-ended base row. Two details cause most bugs here: time zones (a sale that starts "at midnight" needs to say whose midnight, see Currencies and Localization) and overlapping windows (decide a tie-break rule, such as "lowest price wins" or "latest created wins", and write it down).

JS A price-list resolver with scheduled prices

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Ana pays the regular 249.00 on 20 November and the scheduled 199.00 on 28 November, with a "save 20%" label computed from the compare-at price. Bob is in the wholesale group, so he gets his list's 150.00 regardless of the retail sale. For the lamp, the wholesale list has no row, so Bob falls back to the retail price.

Tiered and volume pricing

Quantity breaks reward bigger baskets. There are two different meanings of "tiered", and mixing them up produces surprising totals.

  • Volume pricing: find the tier for the total quantity, and that unit price applies to every unit. Buy 11 and all 11 cost the 11+ price.
  • Graduated (true tiered) pricing: each unit is priced by the tier it falls into. The first 10 cost the first-tier price, units 11 to 50 the second, and so on.

Volume pricing is simpler to explain on a product page ("10+ units: 9.00 each"). Graduated pricing is common in SaaS billing and avoids cliffs.

JS Volume versus graduated tiers

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Look at quantity 10 and 11 in the volume column: ten units cost 100.00, but eleven cost only 99.00. A customer who wants 10 can pay less by buying 11. That is a legitimate, well-known artifact of volume pricing, but you should know about it, and you may want to show the cheaper option in the cart ("add 1 more and save"). Graduated totals never decrease as quantity grows, but they are slightly harder to explain.

Quantity tiers must be applied to the right quantity. If the same SKU appears in two cart lines, or in several variants of one product, decide whether the tier counts per line, per SKU or per product, and apply that rule consistently in the cart and at checkout.

Customer groups and B2B prices

B2B stores add three ideas on top of retail pricing:

  1. Customer groups (retail, wholesale, VIP, employee). A group points to a price list, and sometimes also controls tax display and payment terms.
  2. Contract prices: a specific company has negotiated prices for specific SKUs, valid for a period. Model these as a price list assigned to that company, with fallback to the group list, then to retail.
  3. Minimum order quantities and pack sizes: wholesale items often sell only in multiples of 6 or 12. This is a cart validation rule, not a price.

Be careful with visibility. In a B2B shop, prices should be shown only to logged-in, approved customers. Pages with customer-specific prices cannot be cached publicly, so serve a generic page and load personalized prices separately. A cacheable page shell plus a small private request for the customer's prices keeps both speed and privacy.

Price display rules

What you show is regulated and important for trust:

  • Tax-inclusive or exclusive. Consumer shops in the EU, UK, Australia and many other regions show prices that include tax. In the United States, shops usually show prices before sales tax. B2B shops often show net prices. See Sales Tax, VAT and GST.
  • Currency and rounding. A displayed price must equal the charged price, down to the minor unit.
  • Reference ("was") prices. Many jurisdictions limit what a crossed-out price may be. In the EU, the rule (from the Omnibus directive) is that the previous price shown for a reduction should be the lowest price applied in a prior period, generally 30 days. Other countries have their own rules. Check the law where you sell; this lesson is not legal advice.
  • Unit prices. Some markets require a price per kilogram, liter or 100 ml next to the pack price.
  • "From" prices. A product with variants priced differently is usually shown as "from 19.00", with the exact price shown once a variant is chosen.

A small helper can make an honest reference price a code-level guarantee instead of a marketing hope:

JS Only show an honest 'was' price

Press Run (or Ctrl + Enter) to see the console output here.

No output.

On day 31 a sale at 99.00 shows no "was" label, because the product already sold for 99.00 within the previous 30 days. A sale at 110.00 does not either: the lowest recent price was 99.00, which is lower than 110.00. By day 60 the promotion has fallen out of the window, so the 120.00 reference is honest again and the label appears.

Design checklist

  • Store prices as integers per SKU per price list, with a currency on each row.
  • Keep the base price as an unscheduled row, so there is always a fallback.
  • Resolve with a fixed order: customer or contract list, then group list, then default list; then scheduled rows beat base rows; then quantity tiers.
  • Make the resolver a single function with tests, used by the product page, cart and checkout alike.
  • Snapshot the resolved unit price on the cart line and the order line, so later price edits never change an order that already exists.
  • Log which list and rule produced a price. "Why did this customer pay that?" will be asked.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is the role of a compare-at ("was") price?

    The compare-at price exists to show a reference next to the real price. If calculations read it, a label change would change what customers pay.
  2. 2. A product has volume tiers 1+ at 10.00, 11+ at 9.00. How much do 11 units cost under volume pricing and under graduated pricing?

    Volume pricing charges all 11 units at 9.00 (99.00). Graduated pricing charges the first 10 at 10.00 and the 11th at 9.00 (109.00).
  3. 3. A wholesale customer asks for a SKU that is missing from the wholesale price list. What should a good resolver do?

    Price lists are layered from specific to general, so wholesale lists only need rows that differ from retail.
  4. 4. Why should the unit price be copied onto the order line when an order is placed?

    Prices change, but an order records what the customer agreed to pay. A snapshot keeps invoices, refunds and reports consistent.

Summary

  • Separate catalog data from price data: SKUs appear in price lists, and a resolver turns a context into one price.
  • The compare-at price is display-only; the charged price comes from the resolver.
  • Layer price lists from specific (contract) to general (retail) with fallback, and add start and end dates for scheduled prices.
  • Volume pricing applies one tier to every unit; graduated pricing prices each unit by its own tier. Know which one you offer.
  • B2B needs customer groups, contract prices and quantity rules, plus private (uncached) personalized pages.
  • Follow local display rules for tax, reference prices and unit prices, and snapshot the resolved price on the order.

Next: Building a Promotions Engine.