I am implementing an e-commerce website in core PHP. Currently, if a guest user adds some products to the cart and later logs in then all the items in his existing cart are replaced with the new items. I wanted to ask is it the best way or should I merge the guest user cart items in cookie to that of that with user’s cart items which are stored in the database.
Share
I would do it like this: when user added some cart items and then logs in, a prompt appears (if logged user old cart is not empty):