Why this is a modeling exercise
There is no unit-of-measure resource to configure, and one is not required for most implementations. Two facts shape the design:
- Unit-based pricing is primarily a display concern. The buyer needs to see and trust the per-unit price while shopping. The exact billed amount is frequently recalculated downstream, when the supplier weighs or measures the goods at shipment, by the system that handles fulfillment.
- Money is stored as integers. Prices are integer-based (cents, or high-precision fractions), so a "per kilogram" price has to be expressed through a model that integer amounts can represent.
So the goal is not to make commercetools compute the final weighed invoice. It is to represent the per-unit price the buyer expects, carry a sensible order through checkout, and let the fulfillment system produce the definitive figure.
Approach 1: variant-based discrete quantities
This is an established pattern among grocery and B2B distribution customers, where buyers select from standard weight or volume increments rather than entering an arbitrary amount. It keeps pricing entirely within native price selection (each variant is just a SKU with a price) and works cleanly with the Channel-based negotiated pricing from earlier in this module. It fits best when the business genuinely sells in a fixed set of increments.
Approach 2: smallest-unit modeling
- Store the price of one gram as the Standalone Price (using high precision if a single gram costs a fraction of a cent).
- A Custom Field or a middleware layer multiplies up to the display unit, for example presenting "× 1000" as the per-kilogram price.
- The Cart carries the order in the smallest unit, and the definitive order and invoice are produced downstream when the goods are weighed at shipment.
This approach suits products with variable, continuous quantities where discrete variants would be impractical. It trades a little more integration effort for the flexibility to price any quantity.
Where the platform hands off
Worked example: Atlas Corporate bulk materials
Atlas Corporate's APAC division buys two materials from Zen Electron Trade's industrial range:
- Pre-cut mounting brackets, sold only in packs of 10, 25, and 50. Model these as variants (one per pack size), each with a Channel-scoped Standalone Price. The buyer picks a pack; native price selection does the rest. (Approach 1.)
- Bulk thermal compound, sold by weight to whatever quantity a job needs. Model the smallest unit (one gram) as a high-precision Standalone Price, and have middleware present "per kg" to the buyer and carry the gram quantity on the Cart. At shipment, the warehouse weighs the dispensed amount and the fulfillment system issues the definitive invoice. (Approach 2.)
The same buyer uses both approaches because the products differ: discrete increments fit variants, continuous weight fits smallest-unit modeling, and in both cases the precise billed figure for weighed goods is settled downstream.
Key takeaways
- commercetools has no native unit-of-measure price; unit-based pricing is a modeling exercise, and it is primarily a display concern.
- The variant-based approach models discrete quantity increments as variants, each with its own Price, best for a fixed set of increments.
- The smallest-unit approach prices the smallest indivisible unit and converts to the display unit via a Custom Field or middleware, best for continuous quantities.
- For weighed or measured goods, the commercetools order is often preliminary; the definitive amount is recalculated downstream at fulfillment.