Adding an Empty Cart button to your store might look like a bad idea. Why would you want to make easier for your customers to empty the cart with one click? You don’t want them to leave without buying!
Do you know what is even worse than that? Having a grumpy customer. If the customer doesn’t want to buy it’s not a missing Empty Cart button that will make the difference.
So make their life easier and add it.
Before implementing any code changes, always ensure your site is backed up. This will help you restore things in case of unforeseen errors. I recommend using Jetpack Backup for real-time backups and one-click restores.
Open your functions.php file in wp-content/themes/your-child-theme-name/ and add this code at the end of the file:
This code adds the button right after the Apply Coupon button on the Cart page.
Of course, just the button alone is not enough. You need to add some more code right after the previous one:
This is the logic that handles the Empty Cart button, and removes all the products at once, redirecting to the cart page again.
Creating a custom Empty Cart button
With this code in place, you can also create a custom button or a simple link to empty the cart. Just get any link
Here are two different examples: