Volume discount, decided by a Shopify Function. This page is ready
The bulk editor writes custom.volume_tiers; this reads it at checkout. Same parser on both sides.
What the editor should be writing.
Accepted as 6+ → 10%, 12+ → 15%.
Shopify would accept most of what this rejects — the metafield is typed json, so the shop checks that it parses and nothing more. A write that never leaves the app also spends no points against the cost limit.
| Cart line | Quantity | Discount | Why |
|---|---|---|---|
| Product A (the one you are editing) | 12 | 15% | Buy 12+, save 15% |
| Product B (always valid tiers) | 20 | 15% | Buy 12+, save 15% |
A product whose metafield cannot be read loses its own discount and nothing else. Throwing instead would mean one mis-edited product turns the promotion off for the whole cart — and a Function that throws applies no discount at all, with no way to tell the merchant.
{
"discountApplicationStrategy": "FIRST",
"discounts": [
{
"targets": [
{
"cartLine": {
"id": "gid://shopify/CartLine/1"
}
}
],
"value": {
"percentage": {
"value": 15
}
},
"message": "Buy 12+, save 15%"
},
{
"targets": [
{
"cartLine": {
"id": "gid://shopify/CartLine/2"
}
}
],
"value": {
"percentage": {
"value": 15
}
},
"message": "Buy 12+, save 15%"
}
]
}A percentage, not a computed amount. The Function does not know the currency’s rounding rules, what tax treatment applies, or which discounts Shopify has already allocated — a money figure worked out without those is wrong in a way that is very hard to notice.