Created
July 26, 2024 07:14
-
-
Save AnanthFlycart/f3f872cfcbb7be25939b331d2ab53e28 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** | |
* Check user has discount or not. | |
*/ | |
if (class_exists('\Wdr\App\Controllers\DiscountCalculator') && !empty(\Wdr\App\Controllers\DiscountCalculator::$applied_rules)) { | |
// the user has discounts | |
} else { | |
// the user doesn't have any discounts | |
} | |
/** | |
* Check if the product has discount or not. | |
*/ | |
$product = 12; // you need to pass product or its id to check | |
if (apply_filters('advanced_woo_discount_rules_get_product_discount_price', false, $product) !== false) { | |
// the product has discounts | |
} else { | |
// the product doesn't have any discounts | |
} | |
/** | |
* Check if the cart item has discount or not. | |
*/ | |
$cart_item = '23db6982caef9e9152f1a5b2589e6ca3'; // you need to pass cart item or its key to check | |
if (apply_filters('advanced_woo_discount_rules_get_cart_item_discount_price', false, $cart_item) !== false) { | |
// the cart item has discounts | |
} else { | |
// the cart item doesn't have any discounts | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment