I need to somehow detach the quote from the customer session so it is still sitting in the DB marked as active but no longer part of the customer session (still with the customer_id in the DB record though). I've been scouring all the customer session and quote code but can't see anything obvious that helps me implement this.
Anyone got any ideas?
Best Answer
If you're looking to reset the current customer's quote to a blank quote (e.g. to 'save' their cart for later) the following should suffice (untested code):
To change the current quote:
To get rid of the current quote altogether:
Edit
If you want to forcefully reattach a customer's quote to another customer, you can change the
customer_id
of thesales_flat_quote
field:For registered customers:
$quote->setCustomerId($customer_id);
For guests: