On this page
What this issue is
A coupon has an end date. After that moment the checkout should reject it with a message such as "This coupon has expired". With this issue, the code is still accepted and the discount is applied to the order.
It is the opposite of a valid coupon being rejected. Here the shop is too generous, and the problem is easy to miss because nobody complains about a discount that works.
Why it costs you leads or sales
The cost is margin, not traffic. Orders still arrive, but at a price you no longer meant to offer. Expired codes also get shared on coupon sites and forums, so the leak can grow after the promotion ends.
It can also hurt your next promotion. If shoppers learn that old codes keep working, they wait for a discount instead of buying at full price. Your reports then show sales that look healthy while profit per order drops.
Example: illustrative numbers showing how an expired 20% code that keeps working lowers average order margin.
- Promotion endsEnd date passes
- Shopper enters old codeFound on a coupon site
- Expiry checkWrong time zone, no end date or cache
- Discount appliedOrder placed at reduced price
The promotion ends, but the checkout never enforces the end date.
How to check if your site has it
Run a negative test: use a code you know has expired and confirm it is refused. Do it in a private window so no old cart or cookie interferes.
List your expired codes
Open your coupon or discount list and note codes whose end date has passed. Include codes from old email campaigns.
Open a private window
Add a product to the cart as a guest so you start with a clean session.
Enter the expired code
Apply it in the cart and at checkout. A correct store shows an error and the total does not change.
Test around the cut-off
Create a test code that ends in a few minutes. Try it before and after the end time to catch time zone mistakes.
Try other entry points
Test any discount link, the mobile checkout and any express payment button, since each may check the code differently.
How to fix it
Start by finding out which cause applies. The usual ones are below.
| Cause | What you see | Fix |
|---|---|---|
| No end date set | Code never expires | Add an end date or deactivate the code |
| Time zone mismatch | Code works for hours or a day after the end | Set the end time explicitly in the store time zone |
| Cached cart or page | Discount stays on a cart made earlier | Exclude cart and checkout from caching, clear the cart |
| Duplicate code | Old code is blocked but a similar one is active | Search for codes with the same text and remove extras |
| Custom discount logic | Front end rejects, server accepts | Validate the date on the server |
Edit the coupon
In WooCommerce go to Marketing > Coupons, open the code and set Coupon expiry date under General. Update the coupon.
Check the site time zone
Go to Settings > General and confirm the Timezone matches your business. WooCommerce expiry dates follow the site time zone and apply by date.
Exclude cart and checkout from cache
In your caching plugin, make sure the Cart and Checkout pages are never cached. Then clear the cache.
Set an end date
Go to Discounts, open the code and under Active dates tick Set end date. Choose date and time, and save.
Check the store time zone
In Settings > General, confirm the store time zone. The end time uses it.
Look for duplicates and apps
Search Discounts for the same code text. If a discount app also creates codes, check its own expiry setting.
Validate on the server
Compare the current UTC time with the stored expiry on every apply and again when the order is created. Do not rely on the browser.
Store expiry as a timestamp with a zone
Save the end as a UTC timestamp to avoid ambiguity between regions.
Return a clear error
Reject the request with a message such as "This coupon has expired" and remove any discount already attached to the cart.
function isCouponValid(coupon, now = new Date()) {
if (!coupon.active) return false;
if (!coupon.expiresAt) return false; // treat missing end date as invalid unless intended
return now.getTime() < new Date(coupon.expiresAt).getTime();
}
// Run it when the code is applied AND when the order is placed
if (!isCouponValid(coupon)) {
throw new Error('This coupon has expired');
}How to confirm it's fixed
- The expired code is refused in a private window with a clear message
- The cart total does not change after entering it
- A short-lived test code stops working right after its end time
- The code is also refused on mobile and through any discount link
- A cart created before expiry does not keep the discount at checkout
- No duplicate code with the same text is still active
How to prevent it happening again
- Always set an end date and time when you create a promotion
- Add a coupon expiry test to your promotion launch and wrap-up checklist
- Review the coupon list monthly and delete codes you no longer use
- Keep cart and checkout out of any page cache
- Use unique codes per campaign so one leaked code is easy to retire
- Re-test after theme, plugin or checkout changes
Day 0
Promotion ends but the code still works.
Day 3
The code appears on a coupon website.
Day 10
Discounted orders keep arriving, with no error to notice.
Day 30
A margin review spots the pattern and the end date is fixed.
How FunnelGuard handles this
FunnelGuard detects this issue only partly. A negative-path journey can assert the result: you set up a journey that enters a code you know has expired and checks that the checkout rejects it and the total does not drop. FunnelGuard runs that journey on a schedule from the EU or the US, re-checks a failure from a second region and sends one alert with a screenshot and a likely cause.
What it does not do: it does not discover expired codes for you, and it only tests the codes you give it. It does not review your full coupon list, spot duplicate codes, or find leaks through discount links, other devices or other entry points unless you add a journey for each. It also stops before payment unless your store's test mode is set up, so it checks the discount at the cart or checkout step, not on a completed order.
Cover the rest by hand: review your coupon list each month, test around the end time of every new promotion, and compare order totals in your reports with expected prices. The free plan includes 1 site and 2 journeys with daily checks and no card, and every paid plan has a 3-day free trial.
Questions people ask
Why is my expired coupon still working?
Usually the end date is missing, set in a different time zone, or not checked on the server. A cached cart or a duplicate code with the same text can also keep the discount alive. Check the coupon's end date first, then the store time zone.
How do I make a coupon expire automatically?
Set an end date and time on the coupon. In WooCommerce use the Coupon expiry date field, and in Shopify use Set end date under Active dates. In custom code, compare the stored expiry with the current time on the server.
Why does my discount code work a day after its end date?
This is often a time zone issue. WooCommerce applies expiry by date in the site time zone, and Shopify uses the store time zone for end times. Check both settings and test a short-lived code to see the real cut-off.
How do I test that an expired coupon is rejected?
Open a private window, add a product to the cart and enter a code you know has expired. The checkout should show an error and the total should stay the same. Also check the final order total, not only the message.
Can a cached cart keep an expired coupon active?
Yes. If a cart or checkout page is cached, or a discount was attached before expiry and never revalidated, the discount can survive. Exclude cart and checkout from caching and validate the coupon again when the order is created.
Can FunnelGuard detect an expired coupon that still works?
Partly. A negative-path journey can enter a known expired code and check that it is rejected. It only tests the codes you configure, so you still need to review your coupon list and other entry points by hand.
Should I delete expired coupons or just let them expire?
Deleting or deactivating old codes is safer, because it removes the risk of a wrong end date or time zone leaving them live. Keep a record of past campaigns first if you need reporting.