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. Unzip zip file using PHP
  2. Handle custom form in WordPress
  3. Disable single page view & archive page view of Custom Post Type - WordPress
  4. Get variation product data on selecting variation options - WooCommerce
  5. Add TinyMCE WYSIWYG (Rich text area) meta box - WordPress

Your Questions / Comments

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