Title: Changes to discount code &#8211; case sensitive
Last modified: June 19, 2025

---

# Changes to discount code – case sensitive

 *  Resolved [ArcticFritid](https://wordpress.org/support/users/metuza/)
 * (@metuza)
 * [11 months, 2 weeks ago](https://wordpress.org/support/topic/changes-to-discount-code-case-sensitive/)
 * Hello,
 * Has there been any changes to discount code and case-sensitive or not?
 * For many years i have been using `if ( $coupon->get_code() == "abcdef" ) {` but
   with latest update of woocommerce my customers did not get any discount and after
   debugging i found that i had to change the above code to `if ( $coupon->get_code()
   == "ABCDEF" ) {` using uppercase.
 * This means that i now need to make sure always using uppercase for my discount
   codes or my code will fail. Tested on 3 different sites with the same issue and
   I can not find anything about this in woo changelogs.
 * Brgds
   Rune

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Support [shahzeen(woo-hc)](https://wordpress.org/support/users/shahzeenfarooq/)
 * (@shahzeenfarooq)
 * [11 months, 2 weeks ago](https://wordpress.org/support/topic/changes-to-discount-code-case-sensitive/#post-18521071)
 * Hi there!
   Thank you for bringing this to our attention and sharing the details
   of your debugging process. I understand how important it is for your discount
   code logic to work consistently, especially when relying on custom code that 
   checks coupon codes.
 * Regarding your question, Coupons are not case-sensitive like we mention here 
   [https://woocommerce.com/document/coupon-management/#adding-a-coupon](https://woocommerce.com/document/coupon-management/#adding-a-coupon)
   
   Also, I reviewed our changelogs and documentation, and there hasn’t been an official
   announcement about changing case sensitivity in coupon codes, so this may be 
   more related to how your custom code interacts with WooCommerce’s API or a subtle
   internal change.To ensure your code is robust and not dependent on case, I recommend
   normalizing the coupon code string by converting both sides of your comparison
   to lowercase (or uppercase). For example:
 *     ```wp-block-code
       if ( strtolower( $coupon->get_code() ) === 'abcdef' )
       ```
   
 * Thank you
 *  Thread Starter [ArcticFritid](https://wordpress.org/support/users/metuza/)
 * (@metuza)
 * [11 months, 2 weeks ago](https://wordpress.org/support/topic/changes-to-discount-code-case-sensitive/#post-18521231)
 * Well, i just checked my old staging site running on woocommerce 9.8.5 and there
   the discount code overview table displays all codes with lowercase and in editor
   with uppercase as that is the way i always is typing their name. And with version
   9.8.5 i can use the below code:
 *     ```wp-block-code
       if ( strtolower( $coupon->get_code() ) === 'abcdef' )
       ```
   
 * Then when i updated my staging site to WC version 9.9.4 the discount code overview
   table displays all codes with uppercase (as i have typed them) unless if i have
   save it using lowercase, then it also appear in overview table in lowercase.
 * So the 9.9.4 version now saves the coupon code as you type it and not as lowercase
   in which it did in version ie. 9.8.5.
 * A little more tricky when using codes as below:
 * `WC()->cart->has_discount( 'xxxx' )
   WC()->cart->apply_coupon( 'xxxx' )WC()->cart-
   >remove_coupon( 'xxxx' )
 * As we need to use case-sensitive comparison for them to work with both uppercase
   and lowercase discount codes. And as you said this behaviour is not mentioned
   in any changelogs.
 * Brgds
   Rune
 *  Plugin Support [shahzeen(woo-hc)](https://wordpress.org/support/users/shahzeenfarooq/)
 * (@shahzeenfarooq)
 * [11 months, 2 weeks ago](https://wordpress.org/support/topic/changes-to-discount-code-case-sensitive/#post-18521268)
 * Hi there!
   Thank you again for the detailed follow-up — it really helps!
 * I’ve tried to replicate the issue on my test site, and indeed, I’m able to see
   the same behavior you described.
    - In **WooCommerce 9.8.5**, coupon codes are saved and displayed in **lowercase**,
      even if you type them in uppercase.
    - In the **latest version**, coupon codes now appear **exactly as typed** — 
      so if you enter a mix of uppercase and lowercase, that’s how they’re saved
      and shown in the overview table.
 * Also, I’ve looked into this and found that our developers are already working
   on making coupon code checks case-insensitive, as mentioned here:
   👉 [https://github.com/woocommerce/woocommerce/pull/58918](https://github.com/woocommerce/woocommerce/pull/58918)
 * Hopefully, this will be resolved soon in an upcoming update.
 *  Plugin Support [LovingBro (woo-hc)](https://wordpress.org/support/users/lovingbro/)
 * (@lovingbro)
 * [11 months, 2 weeks ago](https://wordpress.org/support/topic/changes-to-discount-code-case-sensitive/#post-18521277)
 * Hi [@metuza](https://wordpress.org/support/users/metuza/),
 * Thanks for the detailed follow-up, Rune. I really appreciate you digging into
   the version differences; your insight here is super helpful.
 * You’re absolutely right, starting with WooCommerce 9.9.4, there’s been a subtle
   but impactful shift in how coupon codes are handled. In previous versions like
   9.8.5, coupon codes were automatically normalized to lowercase behind the scenes.
   But in 9.9.4, WooCommerce now appears to preserve the exact case used when a 
   code is entered, which also affects how methods like WC()->cart->has_discount(),
   apply_coupon(), and remove_coupon() work, effectively making them case-sensitive.
 * I ran a quick test on my own staging site, and I’m seeing similar behavior. Existing
   coupons are now displayed in uppercase, and newly auto-generated codes are also
   uppercase by default. However, when I manually enter a coupon code in lowercase
   and save it, it still saves and functions correctly, so lowercase codes do still
   work if entered and used consistently.
 * Since this behavior change hasn’t been documented in the changelogs, I’ll raise
   this internally so we can confirm whether it’s an intentional update or a regression
   and ensure the documentation gets updated accordingly.
 * In the meantime, if you prefer lowercase coupon codes, you can manually edit 
   and save them as such. Just be sure your usage in code matches the exact case,
   or normalize the comparison using something like strtolower() to ensure compatibility
   across all methods.
 * Let us know if anything else comes up!
 *  Plugin Support [LovingBro (woo-hc)](https://wordpress.org/support/users/lovingbro/)
 * (@lovingbro)
 * [11 months, 2 weeks ago](https://wordpress.org/support/topic/changes-to-discount-code-case-sensitive/#post-18521459)
 * Hi [@metuza](https://wordpress.org/support/users/metuza/),
 * Just following up to let you know that this behavior has been confirmed as a 
   regression and is actively being addressed. The WooCommerce team is working on
   restoring case-insensitive handling of coupon codes, and you can track the progress
   here: [https://github.com/woocommerce/woocommerce/pull/58918](https://github.com/woocommerce/woocommerce/pull/58918)
 * Once merged, this should bring back the expected behavior where coupon codes 
   work regardless of letter casing, both in admin logic and during cart interactions.
 * I appreciate you bringing this to light; your detailed observations really helped!
   Let us know if there’s anything else you notice or need help with in the meantime.
 *  [brian.stinar](https://wordpress.org/support/users/brianstinar/)
 * (@brianstinar)
 * [11 months, 1 week ago](https://wordpress.org/support/topic/changes-to-discount-code-case-sensitive/#post-18530339)
 * [@metuza](https://wordpress.org/support/users/metuza/) nice job on the investigation–
   one of the big sites we handle has been dealing with this problem. It caused 
   a ton of issues. We added a front end hack to send this to lowercase, without
   deeply understanding this issue. Your explanation helps us realize this wasn’t
   a conflicting plugins, misconfiguration, or anything besides a mistake on the
   end of WooCommerce.
   Thanks [@lovingbro](https://wordpress.org/support/users/lovingbro/)
   for addressing it quickly on your end. This stuff happens, and it’s important
   it’s handled well, which I think you guys did.
 *  Plugin Support [LovingBro (woo-hc)](https://wordpress.org/support/users/lovingbro/)
 * (@lovingbro)
 * [11 months, 1 week ago](https://wordpress.org/support/topic/changes-to-discount-code-case-sensitive/#post-18530382)
 * Hi [@brianstinar](https://wordpress.org/support/users/brianstinar/),
 * Thank you for your kind words and for taking the time to jump in here — I’m really
   glad Rune’s detailed investigation was helpful to your team as well!
 * Just to update you further, the fix for this case sensitivity regression has 
   already been merged into WooCommerce’s codebase a few hours ago. You can continue
   following the progress on the original pull request here: [https://github.com/woocommerce/woocommerce/pull/58918](https://github.com/woocommerce/woocommerce/pull/58918)
 * The fix will be included in the next WooCommerce release, so feel free to keep
   an eye on our changelog page for the official release notes and schedule: [https://developer.woocommerce.com/changelog/](https://developer.woocommerce.com/changelog/)
 * Thanks again for your feedback and support — if you’ve found this helpful, we’d
   really appreciate it if you could leave us a ⭐⭐⭐⭐⭐ review here: [https://wordpress.org/support/plugin/woocommerce/reviews/](https://wordpress.org/support/plugin/woocommerce/reviews/)
 * It goes a long way in helping us continue to improve WooCommerce for everyone!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Changes to discount code – case sensitive’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 7 replies
 * 4 participants
 * Last reply from: [LovingBro (woo-hc)](https://wordpress.org/support/users/lovingbro/)
 * Last activity: [11 months, 1 week ago](https://wordpress.org/support/topic/changes-to-discount-code-case-sensitive/#post-18530382)
 * Status: resolved