Clear data store (cart) after set time?

I made a shopping cart with following tutorial and all works fantastic!

But I need the data store to expire after maybe an hour? I am running into a situation where customers can add tickets to their cart and leave their browser open and still be able to order tickets after sales have been closed. I’d like my cart to time out after about an hour. Is that possible?

As explained here:

The session storage stores data for a session, meaning that the data is stored until the browser (or tab) is closed.

As i suggested some time back, you need to check this on the server side when purchasing and not rely only on browser storage, as it can easily be manipulated or as in your case get outdated info :slight_smile:

Otherwise, you can try some solution like an action scheduler, which clears the cart content after a certain amount of time …

Thanks Teodor!

I’m not smart enough to figure out how to check it server side but the scheduler just might work. I’ll try that.

Much appreciated and thanks for the quick reply! :beers:

A simple db query with a condition that checks how many tickets are left will do the job :slight_smile:

1 Like

For some reason the scheduler won’t clear the data store. A bug perhaps?

I ended up using a page flow with a wait step. Seems to be working. Not ideal but functioning.