Force empty cart on page load

While I’m not sure if this is possible - has your client thought about the actual user experience of clearing a cart on page load?

  • Let’s say I add visit your website’s home page – an onpageload event is fired off, my cart is emptied.
  • I navigate to a product page from the home page – an onpageload event is fired off, my cart is emptied.
  • I add that product to my cart and decide to go to the Store page to add more items – an onpageload event is fired off, my cart - though I just added a product - is emptied.
  • I add a new product, then go to the checkout page – my cart is emptied.

If it is at all possible to remove products from the user’s cart with some custom JS (paging @kkilat, @Waldo), I would consider potentially doing this as a time-based action - as in, empty the cart if the user leaves and returns after 1 day, 3 days, 7 days, etc. This could be achieved with a cookie or by using local storage. (I wrote a snippet that might be of use to for another forum post.)

Just my (unsolicited) two cents! Hopefully Waldo or Kyle will be able to fill in whether it’s actually possible.