E Commerce · 3 min read · 3 views

The Shopify discount bug that was quietly giving away margin

The Shopify discount bug that was quietly giving away margin
Sentriqo IT Solutions
Published by Sentriqo IT Solutions
October 04, 2026

The sale was working. Orders were up, the dashboard looked great, and nobody on the client side had complained. That is exactly why the problem stayed hidden.

Our client is a US direct-to-consumer brand that runs several big sale weekends a year on Shopify. For a holiday weekend sale they wanted two simple rules: a tiered discount (buy more, save more) and a limit on how many discounted units one customer could buy, to stop resellers.

Both rules were built with Shopify Functions, Shopify's way of running custom discount and checkout logic on its own servers.

What we noticed

During a routine order review, our team spotted orders with more discounted units than the limit allowed, and a handful where the final price was lower than any tier should produce. 40% of orders affected.

No errors. No failed checkouts. Just margin leaking out, one order at a time.

What was actually wrong

We traced it to two issues working together:

  1. The quantity limit counted per line, not per cart. If a shopper added the same product in two variants (for example two colours), each line passed the check on its own. Together they went over the limit.

  2. The tier discount could combine with another active discount. Shopify lets discounts combine when their combination settings allow it. One setting was left open, so in some carts the two stacked.

Neither bug shows up in a quick test. You only see it with real shopper behaviour: mixed variants, codes from an email, and a busy weekend.

How we fixed it

  • Rewrote the limit to add up quantities across all lines of the same product before checking.

  • Locked down which discounts are allowed to combine, and wrote the rules down in one table the marketing team can read.

  • Built a test cart list of [ADD: number] real-world combinations (mixed variants, stacked codes, edge quantities) and ran it before every sale went live.

  • Added a simple daily check: any order where discount exceeds [ADD: threshold]% gets flagged to the team.

The result

Over the next two sale weekends, zero orders went over the limit, and average discount per order dropped from 50% to 35%.

What we would do differently

We should have built the test cart list before the first sale, not after. Discount logic looks simple on paper and breaks in combination. Today we write that list at the spec stage for every promotion.

If you run sales on Shopify

Three questions worth asking your team this week:

  • Do our quantity limits count per cart or per line?

  • Which of our discounts are allowed to combine, and is that written down anywhere?

  • Does anyone look at orders with unusually high discounts after a sale?

If any answer is "not sure", we're happy to take a look. Book a 30-minute Shopify review — no pitch, just a list of what we'd check.

Tags: shopify discount D2C sale discount

Related Articles

Comments

Leave a Comment

1