URL Parameter to Clear the Cart
1
When putting together bundles or products that go together (using the /?add-to-cart=73,82 url parameters), it would be very helpful to have a “clear the cart” options. For example /?clear_cart?add-to-cart=73,82.
Sample code… add_action( ‘init’, ‘woocommerce_clear_cart_url’ );
function woocommerce_clear_cart_url() {
if ( isset( $_GET[‘clear-cart’] ) ) {
global $woocommerce;
$woocommerce->cart->empty_cart();
}
}
Hi Tom, sorry this wasn’t clear…but there are dozens of already existing features already “baked in” to LF that you simply didn’t know about because I’m rewriting all the documentation in order to cleanup from the 9 months of development.
I’ve just republished the EmptyCart syntax for you here:
https://launchflows.com/documentation/emptycart/