URL Parameter to Clear the Cart

1
10 months agocompleted1

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();
}
}