verbb / wishlist

A Craft CMS plugin for wishlists for your users to save things to
Other
11 stars 12 forks source link

Is it possible to save lists into a cookie or browser storage? #129

Closed outline4 closed 7 months ago

outline4 commented 8 months ago

Question

I would love to have more persistent lists, but not make anybody have to log in or register.

Be able to save a list into browser storage or a cookie so at least it's available on the same device even after you close the page. Sessions seem to be to volatile for our purpose.

Would this somehow be possible?

Additional context

No response

engram-design commented 8 months ago

Wishlist does support saving items to a cookie already? It should be that even when a user closes their browser, so long as it's the same machine and they haven't cleared their cookies, their content should persist?

outline4 commented 8 months ago

Hi, I've programmed this yesterday and you were right, even if you close the browser or open a different browser, the wishlist persists.

BUT: today all of my wishlists are gone?

Can you give more information on how long you save the cookie? What's the name of the cookie? Is it possible to leave the cookie forever?

engram-design commented 8 months ago

So the default cookie expiry is actually session-based (configurable), so while the wishlist items will remain after you close the browser, they'll be dropped once your session with Craft ends. I believe this was done for backward compatibility, so not all guest lists suddenly stuck around forever. I'd consider changing that to something far in the future, like P10Y for 10 years.

The cookie name is Wishlist:sessionId.

outline4 commented 8 months ago

Thanks a bunch!
That clarifies a lot!
You're a life saver!

I'll check that out and hope that my wishlists are sticky now!

outline4 commented 8 months ago

I can confirm that it works as expected! Thanks for helping me out!