If you were to login to Magento and add some products to your basket and then leave the site, these are saved for the next time you return to the site.
This, however, causes an issue when you do return. If, on your return, you added a product to your basket without logging in and then logged in at the start of the checkout process, your guest and saved basket will be merged. This is undesirable.
Is there any way to make Magento clear the saved basket on login if your current basket has items in it?
It looks like the code that governs this is in Mage_Checkout_Model_Session
, specifically where it calls Mage_Sales_Model_Quote::merge
. This means that you have a few options.
sales_quote_merge_before
) and use that opportunity to empty one of the carts. You would have to detect around when this should be done, but it is by far cleaner than the other two.