Created
March 26, 2024 10:32
-
-
Save sarancartrabbit/9d0280c7bc0b152ff95c87ba33c8bb89 to your computer and use it in GitHub Desktop.
Woo Discount Rules: Remove the applied coupon session data when empty the cart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('woocommerce_cart_updated', function() { | |
if (function_exists('WC') && WC()->cart->is_empty()) { | |
// Clear coupon session data | |
WC()->session->set('applied_coupons', array()); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment