Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Balakrishnan-flycart/73791609ffdca3f7088d643533a83333 to your computer and use it in GitHub Desktop.
Save Balakrishnan-flycart/73791609ffdca3f7088d643533a83333 to your computer and use it in GitHub Desktop.
Woo Discount Rules v2 - disable discount rules(coupon will work)
add_filter('advanced_woo_discount_rules_run_discount_rules', function($run_rule, $cart_object){
if (class_exists('\Wdr\App\Helpers\Woocommerce')) {
$applied_coupons = \Wdr\App\Helpers\Woocommerce::getAppliedCoupons();
$coupons_list = array('coupon1', 'coupon2'); // enter your coupon instead of "coupon1, coupon2"
if (count(array_intersect($coupons_list, $applied_coupons)) > 0){
return false;
}
}
return $run_rule;
}, 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment