Created
October 20, 2021 08:28
-
-
Save AshlinRejo/24bd342db913580fd06e97109914df72 to your computer and use it in GitHub Desktop.
Discount Rules v2: Exclude the Composite product item(WPClever) from discount
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
add_filter('advanced_woo_discount_rules_calculate_discount_for_cart_item', function ($calculate_discount, $cart_item){ | |
if(isset($cart_item['wooco_parent_key']) && !empty($cart_item['wooco_parent_key'])){ | |
$calculate_discount = false; | |
} | |
return $calculate_discount; | |
}, 100, 2); | |
add_filter('advanced_woo_discount_rules_include_cart_item_to_count_quantity', function($take_count, $cart_item){ | |
if(isset($cart_item['wooco_parent_key']) && !empty($cart_item['wooco_parent_key'])){ | |
$take_count = false; | |
} | |
return $take_count; | |
}, 100, 2); | |
add_filter('advanced_woo_discount_rules_process_cart_item_for_cheapest_rule', function($calculate_discount, $cart_item){ | |
if(isset($cart_item['wooco_parent_key']) && !empty($cart_item['wooco_parent_key'])){ | |
$calculate_discount = false; | |
} | |
return $calculate_discount; | |
}, 100, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment