Empty Cart Button for WooCommerce

Empty Cart Button for WooCommerce makes the e-commerce store outstanding. International Standards for making the Cart Clear or Empty is natural. If Filled then How Customer removes every Product from Cart One-by-One. That’s very difficult for clients or customers. So the Empty Cart option provides/facilitates that can be cleared by just only One Click. Filter Skills provide you the option for designer or developer makes it Possible to your e-commerce Store as International Standards. It is necessary that Website is developing or designing in WordPress and your Store is belong to WooCommerce store.

Steps

  • Open You WordPress Admin Page
  • From Sidebar select “Appearance” then “Theme Editor
  • From “Theme Files” select “functions.php
  • Past the below code in function.php.
add_action( 'init', 'woocommerce_clear_cart_url' ); function woocommerce_clear_cart_url() { if ( isset( $_GET['clear-cart'] ) ) { global $woocommerce; $woocommerce->cart->empty_cart(); } }
  • Open the Home Page/Cart Page
  • Palace the Button or Text Field
  • Add the link like that for Home Page >> https://yourwebsite.com/?clear-cart
  • Add the link like that for Cart Page >> https://yourwebsite.com/cart/?clear-cart

If this code is not Working then Install the regular Plugin “Code Snippets

  • Add new Snippet
  • Paste the Above Code
  • Add the URL to the Button or Text Link.