Ecommerce::Shopping cart::Where should i store shopping cart data in session or in database

Yosef picture Yosef · May 13, 2010 · Viewed 21.3k times · Source

Where should I store shopping cart data in session or in database? (I think in amazon.com shopping cart after user logout and after month login again his orders that he choose in shopping cart saved) Thanks, Yosef

Answer

Musa picture Musa · Oct 19, 2016

Of course shopping cart data is a critical data. Where to save this data it depends on that user which your e-commerce system works.

  1. With Not Signed (yet) users - You have to save this data on web storage, html5 gives you ability for this.Simple using Front End Storage, which equips any Browser (Cookie, Session Storage, Local Storage). On checkout process system must require sign up from user. After sign up you have to synchronize this data with Database. Otherwise you have not to save this untraceable data on Database.

  2. With Signed users - of course in Database. With this way you can correctly trace Basket of user. If user will sign in from any where you can show her his account and "items for pending payment". And saving this data on Browser storage it depend on your taste.

this information may be helpful too Client side vs server side shopping card storage

enter image description here