Last active
October 4, 2018 07:39
-
-
Save AshlinRejo/1b26f8ec7de1a779ae112b221c24bc56 to your computer and use it in GitHub Desktop.
Woo Discount Rules: Skip some product from bogo like free product when applying second time
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
if(!function_exists('woo_discount_rules_skip_discount_for_free_product_method')){ | |
function woo_discount_rules_skip_discount_for_free_product_method($skip_free_product, $cart_item){ | |
$_product = $cart_item['data']; | |
//Example | |
if(!empty($_product)){ | |
$price = $_product->get_price(); | |
if($price == 0){ | |
if(!empty($cart_item['thwepo_options'])) return true; | |
} | |
} | |
return $skip_free_product; | |
} | |
} | |
add_filter('woo_discount_rules_skip_discount_for_free_product', 'woo_discount_rules_skip_discount_for_free_product_method', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment