notrab / react-use-cart

React hook library for managing cart state
http://npm.im/react-use-cart
Apache License 2.0
367 stars 48 forks source link

Expire after x hours without updates? #98

Closed mattjis closed 1 year ago

mattjis commented 2 years ago

Does the cart ever expire as is?

I don't want my customers coming back in a year with a cart full of products that no longer exist. 48 hours or so would be ideal

notrab commented 2 years ago

Hey @mattjis

This is a great idea!

I think right now what you could do is store a createdAt timestamp on the cart, and then inside of your app use useEffect to check the timestamp, and do whatever you need to.

I think this would make a great addition to the library. I'll have a play around and see how we can support this.