I am developing an eCommerce site and I have a question related to the cart. Currently I have a Cart model and a CartItem model where the cart and its content is stored. When a user adds a product to cart, I create the cart and store the cart ID in session.
My problem is when the user logs out the session is cleared and the user gets an empty cart because the cart ID in session is no longer there.
What is the best way to solve this issue?