Sarathlal N

Clear all cart items using URL - WooCommerce

In WooCommerce, to remove all cart items, user need to click remove item icon one by one in each cart item.

Why we can’t add a remove all cart items option in WooCommerce? I think, it is a nice tweak.

Put below code snippet in your theme’s functions.php or in your custom module’s file.

add_action( 'init', 'woocommerce_clear_cart_url' );
function woocommerce_clear_cart_url() {
	if ( isset( $_GET['clear-cart'] ) ) {
		global $woocommerce;

Then append ?clear-cart string in any of our URL & that will clear our whole cart.

Need Help?

Do you need any help on WordPress & WooCommerce? I'm happy to help you.

Contact Now

Fill the form & submit your query. I will get back to you soon.

Recent Posts

  1. Display all hooks sequentialy that run on a page - WordPress
  2. Get downloadable files of a downloadable product - WooCoomerce
  3. Add actions based on WooCoomerce order status
  4. Stop Google from translating datepicker input field
  5. Add actions based on WooCoomerce order status

Your Questions / Comments

If you found this article interesting, found errors, or just want to discuss about them, please get in touch.