Last active
March 16, 2023 08:32
-
-
Save sarancartrabbit/b311954f75b0308c2a92ee6b7977f9f5 to your computer and use it in GitHub Desktop.
Discount rules v2: Get add-on price calculate the discount price
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_get_add_on_price_with_discount')) { | |
function advanced_woo_discount_rules_get_add_on_price_with_discount($product_price, $product, $quantity, $cart_item, $calculate_discount_from) { | |
if (!empty($cart_item) && isset($cart_item['product_extras']) && !empty($cart_item['product_extras']) && isset($cart_item['product_extras']['price_with_extras']) && !empty($cart_item['product_extras']['price_with_extras'])) { | |
$product_price = $cart_item['product_extras']['price_with_extras']; | |
} | |
return $product_price; | |
} | |
add_filter('advanced_woo_discount_rules_product_original_price_on_before_calculate_discount', 'advanced_woo_discount_rules_get_add_on_price_with_discount', 100, 5); | |
add_filter('advanced_woo_discount_rules_product_price_on_before_calculate_discount', 'advanced_woo_discount_rules_get_add_on_price_with_discount', 100, 5); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment