Created
October 4, 2019 13:20
-
-
Save rameshelamathi/e11ff1c8f6c51631d0789176d16838f8 to your computer and use it in GitHub Desktop.
Apply discount only for downloadable product
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
function woo_discount_rules_exclude_cart_item_from_discount_method($skip, $cart_item){ | |
$product_ids_to_exclude = array(); | |
if(is_object($cart_item['data']) && method_exists($cart_item['data'], 'is_downloadable')) { | |
if(!$cart_item['data']->is_downloadable()) { | |
$skip = true; | |
} | |
} | |
return $skip; | |
} | |
add_filter('woo_discount_rules_exclude_cart_item_from_discount', 'woo_discount_rules_exclude_cart_item_from_discount_method', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment