I want to know which way is better to save the cart items(for the guest users) in an e-commerce site.
Is it better to save the products(as an objects) directly into the session key, or is it better to save them in a new model(database table)?
That’s really up to you. You would make that decision based upon how those two options are different from each other and which one more closely matches your requirements.
Okay, but woudn’t the datebase get clustered with alot new and new guest visits? It doesn’t clear itself like the session data.
Correct. That’s one of the differences between how the two operate. Whether that’s something you want or not isn’t a decision I can make.
You need to decide what’s going to work best for you.
I got it, thank you!