Link Search Menu Expand Document

Clear cart

The clear_cart tag renders a button that clears the customer’s cart.

{% form "clear_cart" %}
	 <input type="submit" value="clear" />
 {% endform %}
<form action="/sites/cart" data-form-action="clear_cart" accept-charset="UTF-8" method="post">
    <input type="hidden" name="_method" value="delete" autocomplete="off">
    <input type="hidden" name="return_to" id="return_to" value="" autocomplete="off">
    <input type="submit" value="Clear">

Extra parameters


The clear_cart tag will reload the customer’s current page by default on form submit. To direct a customer to a different page you can pass a URL as the value of the return_to: param.

The following example redirects to the homepage.

{% form "clear_cart", return_to: '/' %}
	 <input type="submit" value="clear" />
 {% endform %}