Currently developing a shopping cart, the options for persisting the cart, as i see them are:
Have i missed any? which is the best to roll with please?
Thanks
#3 is probably your best bet, because that gives you the most freedom/flexibility. Say someday you want users to be able to save their shopping carts between sessions. Or you want to keep shopping cart histories for your users. Or you decide to run some analytics on shopping cart data.
#2 is a bad solution because of the cookie size limits on browsers. You're setting yourself up for nasty bugs where large shopping carts get corrupted, particularly in older browsers.
Check out the Railscasts episodes #141-#146... Helped me a lot with shopping cart/checkout related stuff (though the episodes don't directly address your question, you will get to see a straightforward method of implementing a shopping cart).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With