I am confused a little as what should be my approach, Working on a design of shopping cart and i need to store shopping cart either in session or in database but not sure which approach would be best.here are the use case
User is not logged in and adding product to cart (Anonymous user) User is logged in and adding product to cart.
Our ShoppingCart is being saved in database and and every update/ edit in ShoppingCart is being updated in database.
Now I need to take care about creating an anonymous customer and than assign this cart to that customer so that add to cart and well checkout can be associated with this customer.
Can anyone suggest me what can be the right way to go for this?
Should I create one anonymous user in database and use it every time a request for new customer (anonymous ) is being created. Place that user in current user session. Perform any operation on cart with respect to the current session.