Summary: How coupon discounts, eligibility, and limits are calculated — written for reviewing or auditing the policy logic itself, not the screens or the code behind it.
A coupon is either a straight percentage off or a straight flat amount off — never both, and never a scaled/tiered rate (like "10% off the first 5 items, 5% off after that"). Whichever type it is, the final discount is always capped so it can never make an item free or push its price below zero. This cap applies automatically; it isn't something anyone has to set.
For the newer, automatically-generated promotion coupons, there's an additional layer: each promotion has a shared "how much can still be discounted" pool. Every time the coupon is used, it draws down that pool. Once the pool is used up, the coupon stops giving discounts even if it hasn't technically expired.
Who a coupon applies to is controlled by a combination of rules, and each rule can be set one of two ways: "only these are allowed" or "everyone except these are allowed." The things a coupon can be limited by are:
A customer only qualifies if they pass every rule that's been set on that coupon — it's an "and," not an "or." Because the "only these" / "everyone except these" choice is made separately for each rule, and isn't applied the same consistent way everywhere in the system yet, the same real-world restriction can currently be built more than one way. Anyone reviewing coupon setup for correctness should check which mode was used, not assume it from the restriction's intent.
There are two separate limit systems, and a coupon only ever uses one:
Whether a used coupon becomes available again after its order is cancelled depends on a configurable list of which order statuses count as "cancelled" for this purpose — so this isn't a fixed rule, it's a setting that can change what counts. For the promotion-pool coupons specifically, there's a one-way rule: if the coupon expires or gets replaced while still attached to an order that's in progress, that order keeps whatever discount it already has, but the order can't draw any more from the pool, and nothing it already received can be taken back.
A hand-created coupon can be edited or deleted by an admin at any time. A promotion-generated coupon cannot — the system blocks any direct edit or delete outright. The only way to change one is to go back and fix, then re-approve, the promotion that generated it. This is a deliberate policy choice, not a technical gap, but it does mean no one — including support staff — can hand-correct a mistake on one of these coupons directly.
ci branch today, not in production — treat it as
not-yet-shipped policy, not current policy, until it ships.There's no visual walkthrough for this article yet.
There's no interactive walkthrough for this article yet.