Created
February 20, 2024 11:04
-
-
Save sarancartrabbit/ad8c86a27ce3a9e6990808adcc84bdfb to your computer and use it in GitHub Desktop.
Woo Discount Rules v2 - Check customized coupon based disable the discount rule
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_filter('advanced_woo_discount_rules_filter_passed', function($filter_passed, $rule, $product, $sale_badge){ | |
$coupon_applied = in_array('your_coupon_code', WC()->cart->get_applied_coupons()); | |
//'array(1,2)' - give rule id as you needed | |
if(in_array($rule->getId(), array(1, 2)) && $coupon_applied){ | |
// Add your additional condition here if required | |
// Your custom logics enter here and return true or false | |
// true -> Run rule | |
// false -> Do not run rule | |
return true; | |
} | |
return $filter_passed; | |
}, 10, 4); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment