Last active
August 3, 2022 09:44
-
-
Save AnanthFlycart/d3b43d681a169fd2f472d8965379d44f 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
| // Exclude bundle parent product quantity if is not BOGO discount | |
| // Exclude bundle child product quantity if is BOGO discount | |
| // Exclude bundle child products from apply discounts | |
| // for WooCommerce Product Bundles | |
| add_filter('advanced_woo_discount_rules_calculate_discount_for_cart_item', function ($calculate_discount, $cart_item){ | |
| if(isset($cart_item['bundled_item_id']) && !empty($cart_item['bundled_item_id'])){ | |
| $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, $type){ | |
| if( | |
| (isset($cart_item['bundled_items']) && !empty($cart_item['bundled_items']) && $type != 'bogo_stock_check') | |
| || (isset($cart_item['bundled_item_id']) && !empty($cart_item['bundled_item_id']) && $type == 'bogo_stock_check') | |
| ) { | |
| $take_count = false; | |
| } | |
| return $take_count; | |
| }, 100, 3); | |
| add_filter('advanced_woo_discount_rules_process_cart_item_for_cheapest_rule', function($calculate_discount, $cart_item){ | |
| if(isset($cart_item['bundled_item_id']) && !empty($cart_item['bundled_item_id'])){ | |
| $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