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 Me

Recent Posts

  1. Get variation product data on selecting variation options - WooCommerce
  2. Add TinyMCE WYSIWYG (Rich text area) meta box - WordPress
  3. Reorder product tabs in single product page - WooCommerce
  4. Download webpage for offline reading - wget
  5. Remove product tabs in single product page - WooCommerce

Your Questions / Comments

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