Hello all, I’ve started web development some months ago and jumped right into Meteor which I found awesome. Right now, I’m working on a small project and I would like to ask you guys something.
Let’s have an eshop and a customer, who is not registered and of course not signed in. I would like for this customer to have a choice to add items to cart and whenever he comes back to the eshop (still unregistered/not logged in), the items are still there in teh cart. So let’s say that he added 3 items to the cart and left the page without registering.
After few hours he came back, saw the items and decided to register. So I create an account and cut + paste items from the cart and put them into the newly created cart of this new account.
Let’s say he then logs out. Now the cart should be empty because all of those items are moved to his account cart.
So… the question is, how do I make this?
My idea was to create a “temporary” account on connection to the site via Meteor.onConnection with clientAddress as key and field for cart items. If customer created an account while having some items in cart, those items would just be put into a newly created cart for this account and deleted from the previous cart.
Is this a good solution? How would you make it better?
Thanks,
Jakub