On this page
What this issue is
When a shopper types a discount code at checkout and it fails, your store shows an error message. This issue is when that message is vague, technical or missing. Examples: 'Invalid code', 'Coupon is not valid', 'Error 400', or a red box that appears with no text at all.
A code can fail for many reasons: it has expired, the cart is under the minimum spend, the code only works on certain products, it was already used, or the shopper made a typo. One generic message hides all of these.
Why it costs you leads or sales
A shopper who has a code in hand expects a discount. If the code fails and the message does not explain why, they do not know whether to retype it, add more to the cart or give up. Some will leave to search for another code. Some will abandon the purchase. Others will contact support, which costs you time.
The impact is usually low per visit, because only shoppers who use a code are affected. But these shoppers are close to buying, and you often sent them the code yourself in an email or ad.
- CartShopper has items and a promo code
- Enter codeCode is typed and applied
- Vague error'Invalid code' with no reason
- PaymentShopper hesitates or leaves
- OrderSale not completed
The shopper is ready to pay, but the unclear message stops the journey.
Example: illustrative numbers only. A clear message with a next step keeps more shoppers than a vague one.
How to check if your site has it
Open your store in a private browser window, add a product to the cart and go to the coupon field. Then try each failure case on purpose and read what appears.
- A random made-up code such as TESTXYZ
- A valid code with a typo or extra space
- An expired code
- A code with a minimum spend, with the cart below it
- A code limited to certain products or collections, with other items in the cart
- A single-use code that was already used
- A code entered in lowercase when it is stored in uppercase
- The same checks on a phone, where the message may be cut off or hidden
For each case, ask: does the message say why it failed? Does it say what to do next? Is it visible without scrolling? Is it readable by screen readers? If any answer is no, fix that message.
How to fix it
Good coupon messages are short, name the reason and give a next step. Example: 'This code needs a cart of at least $50. Add $12 more to use it.' Where your platform only offers one generic message, you can often reword it, or add helper text under the field.
| Cause | Vague message | Clearer message |
|---|---|---|
| Expired | Invalid code | This code expired on 31 May. Check your latest email for a new one. |
| Minimum spend | Coupon not valid | This code needs a cart of at least $50. |
| Wrong products | Error | This code does not apply to the items in your cart. |
| Already used | Invalid code | This code has already been used. |
| Typo | Invalid code | We could not find that code. Check the spelling and try again. |
Find out which messages you can change
WooCommerce has built-in messages for each failure case. Test each case first, so you know which ones are unclear.
Reword with a filter
Add a snippet to a child theme's functions.php or a code snippets plugin. Use the woocommerce_coupon_error filter (shown below) to replace the text for a given error code.
Set the specific details on the coupon
Under Marketing > Coupons, check the minimum spend, product restrictions and expiry date so the built-in messages are accurate.
Check discount conditions
In Discounts, open the code and review minimum purchase, eligible products, customer eligibility and dates, so you know what the shopper sees.
Edit the checkout text
Shopify's discount errors are mostly fixed text. Where your theme or checkout lets you edit text, change it under Online Store > Themes > Edit default theme content. If you cannot change a message, add helper text near the field such as 'Codes need a $50 minimum'.
Tell shoppers the rules where you promote the code
State the conditions in the email, banner or ad, so the failure is less likely.
Use only if you have no direct access
GTM is a last resort. You can add a Custom HTML tag that watches for the error element and replaces its text, but it breaks easily when the theme changes.
Prefer fixing it in the platform
Change the message in your store settings or theme where you can, and keep GTM for tracking.
Open the Ecommerce settings
In Webflow Ecommerce, go to the checkout page in the Designer and select the discount error element.
Edit the error text
Webflow lets you edit the text of the checkout error states in the Designer. Reword it to name the reason and the next step.
Review discount rules
Under Ecommerce > Discounts, check the dates, minimum order and eligible items.
Open the order form or checkout
In Payments or the funnel builder, open the order form that has the coupon field.
Check the coupon settings
Under Payments > Coupons, confirm dates, usage limits and the products the code applies to.
Add helper text
If the error text cannot be edited, add a short line under the form such as 'Codes are case sensitive' and state the rules where you promote the code.
Open the coupon
In the dashboard, go to Marketing > Coupons and open the code.
Check conditions
Review the dates, minimum order and eligible items, so the built-in message matches the real rule.
Add helper text
Wix's coupon errors are mostly fixed. Add the rules next to your promotion so shoppers know them before they try the code.
Open the discount
Go to Commerce > Discounts and open the code.
Check conditions
Review the expiry, minimum subtotal and eligible products.
Add helper text
Squarespace checkout messages are fixed text. Put the code's rules in the banner, email or page that promotes it.
Return a reason code from the server
Make the coupon endpoint return a specific reason (expired, min_spend, not_eligible, used, not_found) rather than a generic failure.
Map each reason to a message
Show the text next to the field, in an element with role="alert" so screen readers announce it.
Keep the entered code in the field
Do not clear the input after a failure, so the shopper can fix a typo.
add_filter( 'woocommerce_coupon_error', function ( $err, $err_code, $coupon ) {
if ( $err_code === WC_Coupon::E_WC_COUPON_MIN_SPEND_LIMIT_NOT_MET ) {
return 'This code needs a larger cart. Check the minimum spend and add more items.';
}
if ( $err_code === WC_Coupon::E_WC_COUPON_EXPIRED ) {
return 'This code has expired. Check your latest email for a new one.';
}
return $err;
}, 10, 3 );Before
- 'Invalid code' for every failure
- No next step
- Message hidden on mobile
After
- Message names the reason
- Says what to do next
- Visible next to the field and announced to screen readers
How to confirm it's fixed
Repeat every failure case
Use the list above in a private window and read each message.
Check on mobile
Make sure the message is visible without scrolling and not cut off.
Check a valid code still works
Apply a working code and confirm the discount shows and the total is correct.
Ask someone unfamiliar
Ask a colleague to try a failing code and say what they would do next.
How to prevent it happening again
- Test the failure cases after theme, plugin or checkout changes
- State minimums, dates and product limits wherever you promote a code
- Review messages when you launch a new type of discount
- Keep a short list of approved wording for each failure
- Check support emails for people confused by codes
How FunnelGuard handles this
FunnelGuard detects this issue only partly. A check can enter a deliberately invalid code in your checkout journey and assert that specific text appears. You tell it which words to expect, such as 'expired' or 'minimum', and it flags the run if that text is missing, for example after a theme update replaces your message with a generic one.
What it does not do: judge whether a message is actually clear or helpful to a human. It cannot tell if your wording makes sense, if the tone suits your brand, or if the message is easy to see on every phone. It only confirms the text you chose is present.
The Free plan covers 1 site and 2 journeys with daily checks and no card needed. Paid plans start at $39/month with a 3-day free trial. A free read-only website audit is also available.
Questions people ask
Why does my coupon say 'invalid code' when the code is right?
The code may exist but fail a rule, such as an expired date, a minimum spend, product limits or a usage cap. Many platforms show the same generic message for all of these. Check the discount settings and test each condition to find the cause.
How do I change the coupon error message in WooCommerce?
Use the woocommerce_coupon_error filter in a child theme's functions.php or a code snippets plugin. Check the error code it receives and return your own text for that case. Test each failure afterwards.
Can I edit the discount code error message in Shopify?
Shopify's discount errors are mostly fixed text. Where your theme exposes it, you can edit text under Online Store > Themes > Edit default theme content. Otherwise add helper text near the field and state the rules where you promote the code.
What should a good coupon error message say?
It should name the reason and give a next step. For example: 'This code needs a cart of at least $50. Add more items to use it.' Keep it short, visible next to the field and readable by screen readers.
Does an unclear coupon message really lose sales?
It can. Shoppers with a code are close to buying, and a vague error leaves them guessing. Some will leave to look for another code or abandon the cart. The effect is usually low per visit but easy to fix.
Should the message say whether a code exists?
Say what the shopper needs to fix, but avoid hints that help guessing valid codes. 'We could not find that code, check the spelling' is fine. Do not list codes or show their format.
Can FunnelGuard tell me if my coupon error message is clear?
Not fully. FunnelGuard can enter an invalid code and assert that expected text appears, so it catches a missing or changed message. It cannot judge whether the wording is clear to a person, so review that by hand.