Last active
February 13, 2017 12:26
-
-
Save dleone81/50d1a29e14acde30b378f3371d20df9e to your computer and use it in GitHub Desktop.
Remove specific product from woo commerce cart
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 remove_product_from_cart() { | |
if( is_cart() || is_checkout() ) { | |
global $woocommerce; | |
$items = $woocommerce->cart->get_cart(); | |
foreach($items as $item_key => $item){ | |
if($item['line_total'] == '0' && $item['line_subtotal'] == '0') { | |
$remove_items = $woocommerce->cart->remove_cart_item($item_key); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment