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
- The topic ‘Hide coupon notification’ is closed to new replies.