Events to disable rules|any specific rules

Events to disable rules|any specific rules

if(!function_exists('woo_discount_rules_apply_rules_method')){
    /**
     * To disable all rules
     * @param $enable boolean
     * @return boolean
     */
    function woo_discount_rules_apply_rules_method($enable){
        //do your check here and return boolean(true, false)
        return $enable;
    }
}
//To disable all rules
add_filter('woo_discount_rules_apply_rules', 'woo_discount_rules_apply_rules_method');



if(!function_exists('woo_discount_rules_exclude_cart_item_from_discount_method')){
    /**
     * Not to apply any price rule for any specific cart item/product
     * @param $disable boolean
     * @return boolean
     */
    function woo_discount_rules_exclude_cart_item_from_discount_method($disable, $cart_item){
        //do your check here and return boolean(true, false)
        return $disable;
    }
}
//Not to apply any price rule for any specific cart item/product
add_filter('woo_discount_rules_exclude_cart_item_from_discount', 'woo_discount_rules_exclude_cart_item_from_discount_method', 10, 2);



if(!function_exists('woo_discount_rules_run_price_rule_method')){
    /**
     * To disable any price rule based on rule id/ any condition
     * @param $enable boolean
     * @param $rule object
     * @return boolean
     */
    function woo_discount_rules_run_price_rule_method($enable, $rule){
        //do your check here and return boolean(true, false)
        return $enable;
    }
}
//To disable any price rule based on rule id/ any condition
add_filter('woo_discount_rules_run_price_rule', 'woo_discount_rules_run_price_rule_method');



if(!function_exists('woo_discount_rules_run_cart_rule_method')){
    /**
     * To disable any cart rule based on rule id/ any condition
     * @param $enable boolean
     * @param $rule object
     * @return boolean
     */
    function woo_discount_rules_run_cart_rule_method($enable, $rule){
        //do your check here and return boolean(true, false)
        return $enable;
    }
}
//To disable any cart rule based on rule id/ any condition
add_filter('woo_discount_rules_run_cart_rule', 'woo_discount_rules_run_cart_rule_method', 10, 2);