How do I stop Magento merging the basket on login?
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.
- Override the session class and force it not to cause the merge.
- Override the quote class and cause it never to merge carts. There may be secondary bugs to this approach if other parts of the system also attempt to merge carts.
- Hook into the event that quote calls (
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.