To clear all items in the shopping cart on a Webflow site, you'll need to use custom JavaScript, as Webflow does not currently provide a built-in way to clear the cart programmatically or with a dedicated button.
localStorage
and within the Webflow eCommerce system.You can create a button that clears the cart and reloads the page, using a simple JavaScript call.
Add a Button to your Webflow page and give it a unique ID (e.g., clear-cart-btn
).
Embed the following custom code in your page (e.g., inside a Before
tag in the Page Settings or Site Settings):
```js
```
This code removes both wf_checkout
and wf_cart
from localStorage
, effectively clearing the user's cart, then refreshes the page.
localStorage
is the appropriate and allowable method to reset cart data.To empty the shopping cart in Webflow, create a button that triggers JavaScript to remove wf_cart
and wf_checkout
from localStorage
, then reloads the page. Webflow does not provide a native cart-clear button, and browser-level cache cannot be cleared programmatically.