Last active
December 21, 2023 07:46
-
-
Save sarancartrabbit/dee8e0d663b55b699dae07c82bf1bd99 to your computer and use it in GitHub Desktop.
Discount rules v2: Get active discount rules
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
if (!function_exists('advanced_woo_discount_rules_is_active_rule')) { | |
function advanced_woo_discount_rules_is_active_rule($rule_id) | |
{ | |
if (class_exists('Wdr\App\Controllers\ManageDiscount') && !empty(\Wdr\App\Controllers\ManageDiscount::$available_rules)) { | |
$rule_ids = array_keys(\Wdr\App\Controllers\ManageDiscount::$available_rules); | |
return in_array($rule_id, $rule_ids); | |
} else { | |
return false; | |
} | |
} | |
} | |
Example | |
// advanced_woo_discount_rules_is_active_rule(8); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment