Why percentage discounts on low unit prices don’t always match the expected total
If a percentage discount produces a total that’s a few cents — or sometimes a few dollars — off what you’d expect, the cause is almost always per-unit rounding.Shopify calculates percentage discounts on a per-unit basis, rounds the result to the currency’s smallest denomination (one cent for USD), and then multiplies by the line quantity. When the discount per unit doesn’t divide evenly into cents, that rounding compounds with quantity.
For a line with quantity Q, unit price P, and percentage D%:
Per-unit discount = P × (D / 100)
Rounded to cents → call this r
Total discount = r × Q
Line total = (P × Q) − (r × Q)
If P × (D / 100) is already a clean number of cents, the result matches the “naive” subtotal × D% calculation exactly. Otherwise, the per-unit rounding gets multiplied by Q, so larger quantities make the gap more visible.
If you need the discounted total to exactly match subtotal × (1 − D%):
Use a fixed amount discount instead of a percentage. A fixed amount is applied to the line as a whole rather than per unit.
Choose a unit price and percentage that divide cleanly into cents. For example, 10% off 0.20(0.02 / unit) is exact at any quantity, but 10% off $0.23 is not.
Sell in larger units. A 6-pack at 1.38with100.138 → 0.14perpack)stillrounds,buttherelativeimpactattypicalquantitiesismuchsmallerthanper−unit−of−0.23.
This rounding is applied by Shopify’s checkout, not by Discount Kit. The same
per-unit allocation behaviour applies to native Shopify percentage discounts
as well.