Week 4 — Coupons Are Algorithms
Thresholds, exclusions, stacking and bundles turn a shopping cart into a set of rules to work through, not a place to guess.
17 August 2026
Core question#
When discounts have rules, how should they be combined?
A single reference price (Week 3) is one comparison. A cart with a coupon, a spend threshold, an exclusion, and free shipping has several rules at once. Treat each rule as an if-this-then-that step: if the cart meets the condition, the discount applies; if not, it doesn’t.
Thresholds and exclusions#
- Threshold: “$10 off orders over $50” only pays out once the condition is met — spending $49 to avoid it gets you nothing, spending $51 wastes $1 of headroom you didn’t need.
- Exclusion: “20% off, excludes sale items” means the coupon’s real scope is smaller than its headline. The applicable subtotal, not the cart subtotal, is what the percentage should be computed against.
Stacking and bundles#
Some sites let two coupons apply together. Many do not. A few apply only the bigger discount. You cannot guess this from the badges; you have to read the rule text.
A bundle is a stacking rule dressed as a single product: “buy the headphones with the case for $20 more” is only a discount on the case, and only if the case is worth more than $20 to you specifically.
Rules, not tricks#
The useful skill here is not memorising coupon tricks. Write down the rule, write down the cart, and check whether adding an item to reach a threshold costs more than the threshold saves. If it does, the “discount” made the purchase more expensive, not cheaper.
The $249 headphones#
Suppose a $30-off coupon requires a $260 minimum spend, and a carrying case costs $25. Buying the case to unlock the coupon looks like “$25 case, minus $30 coupon” — but only if the case was worth buying at all; otherwise it’s $249 headphones plus a $25 item you didn’t want, minus $30, which is $244: five dollars cheaper than $249, and a case sitting unused in a drawer.
The arithmetic is easy. The part worth practising is how narrow the win is, and how fast it turns negative. Change the numbers below and watch where the verdict flips.
Gap to the threshold
Cash cost if you add it and use the coupon
Cash cost of just buying it, no coupon
What the add-on actually cost you
The last field is the one that matters, and it’s the one no checkout page asks you. “What is the add-on actually worth to you” is a number only you have, and a threshold coupon is profitable for the retailer precisely when shoppers leave it blank and assume it equals the price.
The $30 coupon, the $260 threshold and the $25 case are invented for this example. No real promotion is being described.
Learning outcomes#
By the end of this week, you should be able to:
- model a discount rule — threshold, exclusion, stacking, bundle — as a clear if-this-then-that rule
- distinguish a threshold discount from an exclusion and from a stacking rule
- compute the applicable subtotal for a coupon with exclusions, not the full cart subtotal
- identify at least one combination of rules that produces a worse outcome than using one rule alone
- explain why “spend more to save more” can make a purchase more expensive, not less
Before class#
Find a real cart or checkout page that offers more than one discount rule at once — a threshold, a coupon code, a bundle, free shipping over some amount. Write down every rule’s exact condition, not just its headline percentage.
In class#
Trade your cart’s rule set with another pair. Each pair tries to find a combination of items that satisfies every rule for the lowest total spend, then checks: did satisfying one rule — say, a spend threshold — force buying anything that, priced on its own, wasn’t worth it?
What you should leave knowing#
A coupon system is a list of rules, conditions, and an order. Reading the rule text and calculating the right subtotal beats guessing from the badge.
This week has a full lecture — Lecture 3: Coupons Are Algorithms, whose slide deck works through the threshold-trap and bundle examples above live, and whose reasoning is exactly what Assessment 2, Beat the Shopping Cart, asks you to apply to a constrained cart of your own.
Where this goes#
Week 5 asks whether $249, or $244, is even a meaningful number without knowing what this exact model has actually sold for over time.
The spec
What you bring to the session. Written so a reader can tell whether it has been met without asking you.
- writes a discount rule as a clear if-this-then-that rule, not a trick
- names at least one way combining discounts can produce a worse outcome than using one alone
- distinguishes a threshold discount from an exclusion and from a stacking rule
- gives one concrete before-class task and one in-class activity tied to the week's topic
Teaching team
- Idris Fenn — tutor