Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AshlinRejo/1b26f8ec7de1a779ae112b221c24bc56 to your computer and use it in GitHub Desktop.
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
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