Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AshlinRejo/938205a4120a4786efe48a4bf8c43103 to your computer and use it in GitHub Desktop.
Save AshlinRejo/938205a4120a4786efe48a4bf8c43103 to your computer and use it in GitHub Desktop.
Discount rules v2: Get applied discount rules
add_action('woocommerce_before_cart', function (){
if(class_exists('\Wdr\App\Controllers\ManageDiscount') && class_exists('\Wdr\App\Controllers\DiscountCalculator')) {
if (!empty(\Wdr\App\Controllers\ManageDiscount::$calculator)) {
$calc = \Wdr\App\Controllers\ManageDiscount::$calculator;
$applied_rules = $calc::$applied_rules;
//$applied_rules -> here you get applied discount rules
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment