Black Friday is the worst possible time to discover that your discount codes are doing something wrong. Carts are moving, customers are signing up, and every minute the bug is live is another order saved at the wrong price. This is the story of one such bug — a multi-currency coupon miscalculation we traced, diagnosed and fixed on a live WooCommerce subscription store in the middle of its biggest sale of the year — and exactly how you can spot and prevent the same problem on your own site.
The symptom: a 45% coupon giving away almost everything
The client ran a subscription-based WooCommerce membership site. For Black Friday they set up a batch of percentage coupons — a 45% early-bird code and a 40% public code — applied to their recurring membership plans. In the store’s base currency, British Pounds, everything was perfect. A membership priced at £35/month correctly dropped to £19.25 with 45% off.
Then the reports started. A customer paying in a non-GBP currency had taken a monthly plan that should have been discounted by 45% — but the checkout showed it reduced to a tiny fraction of the real price. One example: a plan displaying at 69 in the customer’s currency, which at 45% off should have become ~37.95, was instead showing as 8. That’s not a 45% discount. That’s an 88% discount — and it was about to be saved as the ongoing recurring price on a real subscription.
The discount being applied was 61 off a price of 69. Hold onto that number — 61 — because it’s the whole story.
Narrowing it down
Two facts pointed us straight at the currency layer:
- The base currency (GBP) was flawless. Every wrong order was in a switched currency.
- The coupons were percentages. A percentage is currency-neutral by definition — 45% of a price is 45% whether that price is in pounds, dollars or anything else. There is never a reason to “convert” a percentage. So if a percentage was coming out wrong in another currency, something was treating it as if it were an amount of money.
The site used a popular multi-currency switcher plugin to display and charge in different currencies. That plugin, quite correctly, converts fixed-amount coupons: a “£10 off” coupon should become the local-currency equivalent of £10 when you switch currency. To do that it hooks into WooCommerce’s coupon amount and multiplies it by the exchange rate.
And it had a guard to avoid touching percentage coupons. Here, paraphrased, is the logic it used to decide whether to convert a coupon’s amount:
// Inside the currency plugin's "convert coupon amount" filter:
if ( ! $should_convert || ! currency_filters_active() || $coupon->is_type( 'percent' ) ) {
return $amount; // leave it alone
}
// otherwise, treat $amount as money and convert it:
return convert_price( $amount );
Read that condition carefully. It skips conversion only when $coupon->is_type( 'percent' ) is true. That check matches exactly one discount type: the core WooCommerce percent type.
The root cause: WooCommerce Subscriptions has other percentage types
Here’s the trap. The moment you add WooCommerce Subscriptions to a store, you gain extra coupon discount types that core WooCommerce doesn’t have:
recurring_percent— a percentage off every recurring paymentsign_up_fee_percent— a percentage off the sign-up fee
These are percentages in every meaningful sense. But their type strings are not percent. So $coupon->is_type( 'percent' ) returns false for a recurring_percent coupon — and the currency plugin sailed straight past its own safety check and ran the percentage value through the money converter.
So the “45” in “45% off” was multiplied by the exchange rate as if it were 45 units of currency. With the store’s rate (and a small currency commission, rounded up), 45 became 61 in one currency and 89 in another. WooCommerce Subscriptions then dutifully applied that number as a percentage. 89% off a price of 69 is a 61 discount — leaving the customer paying 8. Every number matched. The math was internally consistent; it was just built on a corrupted percentage. The YITH Multi Currency Switcher for WooCommerce plugin is NOT taking care of this case to correct the discount amount.
| Intended discount | Became (currency A) | Became (currency B) |
|---|---|---|
| 45% | 61 | 89 |
| 40% | 54 | 79 |
The fix: one rule, applied in the right place
The principle is a single sentence: a percentage must never be currency-converted — no matter what the type string is called.
We could have edited the plugin, but editing a third-party plugin means your fix is erased on the next update. The clean solution was to use an extension point the plugin already exposes — a filter that lets you veto the conversion of any given coupon — and tell it to leave any percentage-based type alone. We shipped it as a tiny must-use plugin, so it loads automatically, touches no plugin files, and can be removed by deleting a single file.
<?php
/*
* Plugin Name: Percentage-Coupon Currency Fix
* Description: Never currency-convert the AMOUNT of a percentage-based coupon.
*/
add_filter(
'yith_wcmcs_coupons_filter_coupon_amount',
function ( $do_convert, $coupon, $amount ) {
if ( is_object( $coupon ) && method_exists( $coupon, 'get_discount_type' ) ) {
$type = (string) $coupon->get_discount_type();
// percent, recurring_percent, sign_up_fee_percent, ...
if ( '' !== $type && false !== strpos( $type, 'percent' ) ) {
return false; // tell the switcher NOT to convert this amount
}
}
return $do_convert;
},
10,
3
);
Instead of testing for one exact type, we match any type whose name contains percent. That catches today’s subscription types and any future ones, while leaving genuine fixed-amount coupons — and the plugin’s minimum/maximum spend conversions — working exactly as before.
Verifying it properly
A pricing fix you can’t prove is just a hope. We rebuilt the exact cart calculation — same products, same coupons, each enabled currency — and confirmed the discount came out as a true 45% (and 40%) everywhere, on both the first charge and the saved recurring amount:
- Monthly plan, 45% code, currency A: price 45 → 24.75 (a clean 45% off). Previously it would have been mangled to a fraction of that.
- Monthly plan, 40% code, currency B: price 42 → 25.20 (exactly 40% off).
- The switched-currency case that started it all: price 69 → 38 — a real 45% discount, instead of the broken 8.
Because the fix operates on the coupon percentage itself, it’s independent of the plan or billing period — monthly, annual and every variation are covered by the same one rule.
What to take away for your own store
- Percentages are not money. Any code path that “converts” a coupon should first ask whether the coupon is a percentage — and the test must be broad enough to cover every percentage type, not one hard-coded string.
- Plugins add coupon types. WooCommerce Subscriptions introduces
recurring_percentandsign_up_fee_percent. Memberships, bundles and others can add more. Anis_type('percent')check that looked complete in 2019 can silently stop being complete the day you install another extension. - Test discounts in every currency before a sale — not just the base one. This bug was invisible in GBP and catastrophic in USD and AUD. One quick cross-currency check would have caught it.
- Fix third-party bugs from the outside. A must-use plugin hooking a documented filter is update-safe and instantly reversible. Editing the plugin directly is a fix with an expiry date.
Pricing bugs are uniquely nasty because nothing crashes. No error, no white screen — just money quietly leaving at the wrong rate while the sale runs. The defence is to understand the layers your prices pass through, and to verify the output, not assume it.
This is the kind of problem we untangle. If your WooCommerce store does something subtle and expensive that nobody can quite explain, that’s exactly our idea of a good day.


