Clear Cart Button

One person wanting to use my Javascript Shopping Cart asked how they could modify the shopping cart code in order to provide an extra button to allow the person to clear all of the content from the cart and start over. If fact the code for the cart already includes all of the code needed in order to add such a button since refreshing the web page will automatically clear all of the cart contents as all of the values are actually saved within the page itself.

If you want to add an actual clear cart button to the web page to make it more obvious for visitors as to how to clear the cart and start over you can add the following code into the web page to display a clear cart button.

<button onclick="location.reload()">Clear Cart</button>


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow