Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sarancartrabbit/dee8e0d663b55b699dae07c82bf1bd99 to your computer and use it in GitHub Desktop.
Save sarancartrabbit/dee8e0d663b55b699dae07c82bf1bd99 to your computer and use it in GitHub Desktop.
Discount rules v2: Get active discount rules
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