How to Add an Empty Cart Button in WooCommerce
Shoppers change their minds. They fill a cart while comparing options, decide to start again, or use your store to price a quote and then want a clean slate. In default WooCommerce, the only way to clear the cart is to remove every item one by one. A WooCommerce empty cart button lets customers clear everything in a single click, which matters most for stores with large carts, such as wholesale, spare parts and B2B shops.
In this guide, you’ll learn when an empty cart button helps, how to add one with a plugin or code, and how to stop customers clearing their cart by accident.
When Does an Empty Cart Button Help?
- Large carts: removing 15 items one at a time is tedious.
- Wholesale and B2B: buyers often build several test orders before placing the real one.
- Quote building: customers use the cart to calculate costs, then reset.
- Shared devices: a store computer or family tablet where the next person needs a clean cart.
For small stores where carts rarely hold more than two or three items, the button adds little. Most of the benefit comes when carts are big.
How to Add an Empty Cart Button With a Plugin
Step 1: Install the Plugin
Empty Cart Button for WooCommerce from Simpli Plugin is a free plugin that adds a clear, visible “Empty cart” button to the cart page, so customers can reset their order in one action instead of deleting items individually.
- Download the plugin ZIP from its product page.
- Go to Plugins → Add New Plugin → Upload Plugin.
- Upload the file, click Install Now, then Activate Plugin.
Step 2: Check the Button on the Cart Page
Add a few products to your cart and open the cart page. The button should appear alongside the other cart actions.
Step 3: Test It
- Click the button and confirm every item is removed.
- Check that applied coupons are cleared too.
- Make sure the page shows WooCommerce’s normal empty cart message with a “Return to shop” link.
Need saved carts, quote requests or a “save for later” list for B2B buyers? Simpli Plugin’s team builds custom WooCommerce cart features.
How to Add an Empty Cart Button With Code
Developers can add the button with two hooks. The first clears the cart when a secure link is visited; the second adds the button to the classic cart page:
add_action( 'wp_loaded', function () {
if ( isset( $_GET['empty-cart'], $_GET['_wpnonce'] )
&& wp_verify_nonce( sanitize_key( $_GET['_wpnonce'] ), 'empty-cart' )
&& function_exists( 'WC' ) && WC()->cart ) {
WC()->cart->empty_cart();
wp_safe_redirect( wc_get_cart_url() );
exit;
}
} );
add_action( 'woocommerce_cart_actions', function () {
$url = wp_nonce_url( add_query_arg( 'empty-cart', '1', wc_get_cart_url() ), 'empty-cart' );
echo '<a class="button" href="' . esc_url( $url ) . '">Empty cart</a>';
} );
The nonce check stops outside links from clearing a customer’s cart. The woocommerce_cart_actions hook only exists on the classic cart, so stores using the block-based Cart page need a different approach.
Prevent Accidental Clicks
Clearing a cart by mistake is frustrating. A few safeguards help:
- Place it away from checkout. Don’t put “Empty cart” next to “Proceed to checkout.”
- Use a quieter style. A text link or outlined button, not your main brand color.
- Clear wording. “Empty cart” or “Clear all items” leaves no doubt.
- Consider a confirmation on stores where carts are large and valuable.
Common Problems and How to Fix Them
The Button Doesn’t Appear
Your store may use the block-based Cart page, or your theme may replace the cart template. Check which cart you’re using by editing the Cart page.
The Cart Empties but Shows Old Items
A cached cart page or mini cart is being served. Exclude the cart from caching and refresh.
Coupons Remain After Emptying
Clearing the cart should remove coupons too. If not, test with a default theme to rule out a conflict.
Related Guides
- How to Add a Side Cart to WooCommerce
- How to Set a Minimum Order Amount in WooCommerce
- How to Add Quantity Discounts in WooCommerce (Tiered Pricing)
Frequently Asked Questions
Does WooCommerce have an empty cart button?
No. Customers have to remove items one at a time unless you add a button with a plugin or code.
Will an empty cart button increase abandonment?
Customers who want to start over were going to remove items anyway. Placing the button away from checkout keeps accidental clicks rare.
Can I add the button to the mini cart?
Yes, with custom code or a plugin that supports it. The cart page is the most common place.
Give Customers a Clean Slate
An empty cart button is a small convenience that matters a lot for large carts. Add it, style it as a secondary action and test it on your cart page.
Download Empty Cart Button for WooCommerce for free, and explore more free WooCommerce plugins from Simpli Plugin. If you need custom cart features, our developers can build them.