Title: Hide coupon notification
Last modified: June 14, 2021

---

# Hide coupon notification

 *  Resolved [lenamtl](https://wordpress.org/support/users/lenamtl/)
 * (@lenamtl)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/hide-coupon-notification/)
 * Hi,
 * I’m trying to hide all coupon notification **based on coupon code**.
 * Some coupon are nodiscount item so it does not make sense to display notifications
   for it.
 * case: user add Product A, Product B at regular price(nodiscount) is automatically
   added to the cart. (message added…. is hidden with the code below)
 * If product A is removed from the cart, product B stay in the cart as (nodiscount
   item) but a promo notification is display saying that is not vaid anymore = I’m
   looking for a way to hide it.
 * This code work fine to hide the promo add to cart notification
 *     ```
       add_filter('woocommerce_coupon_message', function($msg, $msg_code, $coupon) {    
        if ('COUPON_CODE' === $coupon->get_code() && 200 === $msg_code) {        
            $msg = '';    
        }     return $msg;  }, 20, 3);
       ```
   
 * This code is not working when removing product A from the cart (promo is no longuer
   valid) notification is displayed and I want to hide it.
 * I have tried notification code 101,100,110 or 201…
    And I have also tried the
   entire code list…
 *     ```
       add_filter('woocommerce_coupon_message', function($msg, $msg_code, $coupon) {    
        if ('COUPON_CODE' === $coupon->get_code() && 101 === $msg_code) {        
            $msg = '';    
        }     return $msg;  }, 20, 3);
       ```
   
 * I don’t know if this is a bug or maybe I’m not using the correct method.
 * Also I’m wondering what would be the code all coupon notification for a temporary
   solution.
 * Thanks

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

 *  [con](https://wordpress.org/support/users/conschneider/)
 * (@conschneider)
 * Engineer
 * [4 years, 11 months ago](https://wordpress.org/support/topic/hide-coupon-notification/#post-14558488)
 * Hi there,
 * > I have tried notification code 101,100,110 or 201…
   >  And I have also tried the
   > entire code list…
 * Maybe adding Javascript to the mix with PHP control statements could do the trick.
 * > Also I’m wondering what would be the code all coupon notification for a temporary
   > solution.
 * As in hide all coupon message for all coupons and message types? I would probably
   use CSS for this.
 * Kind regards,
 *  Thread Starter [lenamtl](https://wordpress.org/support/users/lenamtl/)
 * (@lenamtl)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/hide-coupon-notification/#post-14572034)
 * CSS and JS cannot be use for this case, PHP is the only solution.
    I have opened
   a ticket because this seems to be a bug. I have found a work around, I will test
   it first and I will provide solution soon.
 *  [Mirko P.](https://wordpress.org/support/users/rainfallnixfig/)
 * (@rainfallnixfig)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/hide-coupon-notification/#post-14594319)
 * Hi [@lenamtl](https://wordpress.org/support/users/lenamtl/),
 * I’m going to leave this thread open for a bit to see if anyone is able to chime
   in to help out.
 * Please let us know how testing goes, and feel free to reply on this thread with
   your findings.
 * Thanks.
 *  Plugin Support [Gabriel – a11n](https://wordpress.org/support/users/gabrielfuentes/)
 * (@gabrielfuentes)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/hide-coupon-notification/#post-14617940)
 * We’ve not seen any activity on this thread for a while, so I’m marking this thread
   as resolved.
 * Hopefully, you were able to find a solution to your problem! If you have further
   questions, please feel free to open a new topic.
 * Cheers!
 *  Thread Starter [lenamtl](https://wordpress.org/support/users/lenamtl/)
 * (@lenamtl)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/hide-coupon-notification/#post-14620698)
 * Hi,
 * here is the related ticket
    [https://github.com/woocommerce/woocommerce/issues/30098](https://github.com/woocommerce/woocommerce/issues/30098)
    -  This reply was modified 4 years, 10 months ago by [lenamtl](https://wordpress.org/support/users/lenamtl/).
    -  This reply was modified 4 years, 10 months ago by [lenamtl](https://wordpress.org/support/users/lenamtl/).

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

The topic ‘Hide coupon notification’ 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/)

 * 5 replies
 * 4 participants
 * Last reply from: [lenamtl](https://wordpress.org/support/users/lenamtl/)
 * Last activity: [4 years, 10 months ago](https://wordpress.org/support/topic/hide-coupon-notification/#post-14620698)
 * Status: resolved