Friday, 9 August 2013

Shopping Cart - shop as guest vs logged in user

Shopping Cart - shop as guest vs logged in user

I am developing a shopping cart but getting little confused with
logged-in-user vs guest-user. Users can add items to his cart even without
logging in and then check out as guest.
I want to know if this is the correct way of doing:
If the user is logged in:
1) Users login id becomes his cart id.
2) Whatever items he adds in cart, gets stored in database
If the user is a guest user (not logged in)
1) A new cart id gets generated from session.
2) Whatever items he adds in cart, gets stored in a cookie.
3) All information about this cookie is stored in the database when he
checks out.
Is this process correct ?

No comments:

Post a Comment