-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to guests continue with same cart when they login #670
Comments
Cart is saved in the databse or session. You could save it before login (write to db) and then load it after login (delete & load to session). |
But how can I store the session to the database , because there might be multiple session for multiple users ? And the session id will also get changed after login ? I am very confused idk how to do it properly 😞. |
No you dont save the session to the database. The cart can be either in the session or the database but not booth. A loaded cart is not on the database. LaravelShoppingcart/src/Cart.php Line 399 in f460ab7
Just store the cart with a tmp identifier and load it after the session is renewed. |
i want to make a shopping cart where if guest user adds items to cart and when he logs in all the guest cart items should be shifted from session to database ? how can i achieve that ?
The text was updated successfully, but these errors were encountered: