A leaked discount code alert tells you when a code meant for a few people starts getting used by everyone. Staff codes, partner codes and one-off apology codes can end up shared on coupon sites. Big sale weekends make it harder to spot, because so many codes are live at once.
Most teams find out late. Someone notices the margin looks off, or a partner asks why their code has hundreds of uses.
Here's the system I'd build: a register of every code, tighter settings when a code is made, an hourly check in Shopify Flow, and one person who decides what happens next.
Table of contents
The problem
A discount code is just a word typed at checkout. Once it's shared outside the group it was meant for, Shopify can't tell the difference.
Codes also pile up. Old partner codes, a code made for one upset customer, a code from last year's sale that nobody switched off. Nobody owns them, so nobody watches them.
By the time someone checks the numbers, the orders have shipped and the discount is spent.
How the system is put together
1. A code register. One sheet or one page in your SOP handbook listing every active code: who it's for, who owns it, its limits and its end date. My rule: if a code isn't in the register, it shouldn't be live.
2. Tighter settings when a code is made. Shopify lets you set the dates a code is valid, how many times it can be used and a minimum order amount. You can also limit who can use it to specific customers or customer segments. Private codes should use those limits by default.
3. An hourly check in Flow. A Scheduled time trigger runs every hour. A Get order data step looks for orders that used the watched code in the last hour, with a query like discount_code:PARTNER20 AND created_at:>'{{ scheduledAt | date_minus: "1 hour" }}'. A Count step counts the results. If the count is above the line you set for that code, Send internal email alerts the ops owner with the order names.
4. Two things to know about that query. Shopify's API notes the discount code filter only looks at the first code used on an order. And Flow's help page warns that if a query fails, it can return all results instead of none. Test the query on your store before you trust the alert.
5. A weekly list of live codes. Flow has a template that emails a summary of active discounts that use a code, every Monday at 9am. The ops owner compares it with the register. Anything live that isn't on the register gets a question.
6. A person decides. When an alert lands, the ops owner checks the orders and the Sales by discount report, then talks to the code's owner. If the code has leaked, they deactivate it. Shopify says customers then see an error that no valid discount matches the code. They leave a note in the discount's timeline so the next person knows why.
7. Who owns what. Marketing owns each code and its limits. The ops manager owns the register, the workflows and the first call on an alert. Founders decide whether to honour orders already placed with a leaked code. Support gets a saved reply for customers whose code stops working. Owners come from your ownership map.
8. Automatic versus human. Flow runs the hourly check, counts and emails. It also sends the weekly list. People set the limits, read the alert, decide whether a code has leaked and switch it off. I wouldn't let Flow deactivate codes on its own, because a busy hour for a real campaign looks the same as a leak.
What it solves, and the effect on the business
It closes the gap between a code leaking and someone noticing. Instead of finding out at the month-end review, the owner hears within the hour.
It also cleans up the pile. The weekly list and the register mean old codes get switched off on purpose, not forgotten.
The effect shows up in margin, in partner relationships and in fewer awkward customer conversations. I don't have figures to share here, so measure it yourself.
Baseline before you start: how many codes are live, how many have no owner or no end date, total discount given on private codes over the last quarter (from the Sales by discount report), and how long it took to notice the last leak.
Compare after a month. My targets would be: every live code is in the register with an owner and an end date, every private code has a usage limit, and every alert gets a decision the same working day. Treat these as targets, not results.
The bigger picture
This is the same pattern as my price-error alert and high-value order check: let Flow watch for the unusual thing, and let a person make the call.
It also fits how discounts are changing. Shopify can now test discounts on part of your traffic, so more codes and more variations will be live at once. A register keeps that under control.
If you want help setting this up, it's part of my ecommerce operations services.
Build checklist
- Export your live discount codes and build the register: code, audience, owner, limits, end date.
- Switch off any code nobody can explain.
- Add usage limits, end dates and customer eligibility to every private code.
- Build the hourly Flow workflow: Scheduled time, Get order data, Count, condition, Send internal email.
- Set a line per watched code, based on how many people it was meant for.
- Test the query on your store so a failed query can't send a false alarm.
- Turn on the weekly active discounts summary and compare it with the register.
- Write the saved reply for support and agree who decides on orders already placed.
Discount codes are easy to make and easy to forget. The system just makes sure each one has an owner, a limit and someone watching it.
Source: Shopify Help Center: Discount codes, Managing and editing discounts, Shopify Flow Get order data, Count and Get discount data; Shopify API docs: orders query filters. The system design and expected effects are my operator view.
Frequently asked questions
Can Shopify Flow see which discount code an order used?
Yes. Orders carry their discount codes, and Get order data can filter by code. The filter only checks the first code used on an order.
What happens when I deactivate a leaked code?
Customers who enter it get an error saying no valid discount matches the code. You can reactivate it later if you need to.
Should Flow switch off the code automatically?
In my setup, no. A busy hour for a real campaign looks like a leak, so a person checks the orders and decides.
How do I limit who can use a private code?
Set a usage limit and an end date, and limit eligibility to specific customers or customer segments when you create the code.