Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hello. I notice the cart uses sessions to store items added to it. Can cart be modified to use cookies vs sessions? One of my clients has heard from customers that they have added items to their cart then come back later or the next day/so and have to start over with adding items to the cart as it has emptied.

Ty
Hi,

There is a limit to how much data can be stored in cookies (4,096 bytes for some browsers) so cookies cannot be a viable alternative to session when it comes to cart data.

Database would be the correct place for making this change; it will have its own set of considerations though e.g. it would make sense to save cart into the database for only logged-in users.

Out of the box, CouchCart assumes only simple scenarios so this option is not available I am afraid.
Perhaps, I should add some events in the cart saving process to allow addons to chip in?
Browser's local storage maybe? Google shows save cart in local storage is a viable (simpler) option.

I agree with @KK - database storage has features - allows to store cart indefinitely, track price changes, product availability / qty upon revisit, create analytical reports for a merchandiser / owner. Cookie can store a uid from the db about location of the cart info.

Nevertheless, I believe shop owners benefit from persistent cart option of unregistered / anonymous visitors.

your best friends: github, StackOverflow, telegram
I also believe shop owners would benefit from a persistent cart option of unregistered / anonymous visitors as trendoman has mentioned. If anything, a quarterly CRON could be created to purge out old saved carts of guests while leaving the logged in users cart intact.

I will have to give this more thoughtful planning to determine how/if I can integrate this idea of database saving the cart into the code and how to retrieve it later. It may be beyond my abilities but I am currently unsure as I don't have a clear picture of the method/flow that would be used yet to accomplish this.

The browsers local storage option is interesting, I have never used and will look into it.

Thank you for both of your replies and am grateful for any other thoughts you may have to help guide me to a solution.
4 posts Page 1 of 1