Created
December 2, 2015 16:39
-
-
Save psahalot/2e2df59635ed2bdc5a08 to your computer and use it in GitHub Desktop.
Empty WooCommerce cart before adding new product
This file contains 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
add_filter( 'woocommerce_add_cart_item_data', 'ps_empty_cart', 10, 3); | |
function ps_empty_cart( $cart_item_data, $product_id, $variation_id ) { | |
global $woocommerce; | |
$woocommerce->cart->empty_cart(); | |
// Do nothing with the data and return | |
return $cart_item_data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment