This release introduces what I hope is support for guest customers. I have had a number of users telling me when developing an app that when a customer adds items to the cart and another user adds items to the cart on another device, all items are merged together.
To my knowledge these apps are developed for Android. I don’t know if this issue is the same in other apps developed for other devices.
Now I’m not an Android developer but that should not be happening and it became clear that it was not handling sessions correctly or at all.
So I have added my attempt at manipulating a session for guest customers in order to create an individual cart for them.
To do this, when a guest customer adds an item,
for the first time a unique generated ID is created and stores that ID into a cookie called
Once the item is added to the cart, the whole cart is then copied to the stores database under that unique ID. e.g.
That cookie is then used to get the unique ID so the developer can fetch the saved cart and return it’s content.
The cart is updated every time an item is added, quantity is updated in the cart, item is restored to the cart, a coupon is applied, a coupon is removed, cart totals and fees are calculated.
The cookie and the copied cart are only cleared from the database if all items were removed or an order was created.
For the time being I have only added the option to get the cart contents, (until I get positive feedback that what I have done works) then if all is good I will apply support to the other endpoints if needed.
So download and test CoCart v2.1 Beta 1 today and provide me your feedback.