TL;DR When a customer is logged in, Mage::getSingleton('checkout/session')->clear(); doesn't clear their cart. I need something that will.
I've asked this as part of another question, but i discovered it was actually two problems, other other one now fixed.
I'm programatically creating an order in a controller using the items in the cart. After the order is saved the cart should be cleared. I do this using
Mage::getSingleton('checkout/session')->clear();
which works fine most of the time. The problem comes when the customer is logged-in. If they are logged in the cart doesn't clear. I've found other solutions (like load the cart items and removed them one at a time in a loop) but they don't meet all my requirements. WHat I need is something that will:
- remove all the items (obviously)
- stay on the same page (why loading the cart doesn't seem to work. I end up redirected to the cart page)
- NOT go to another page and then come back (2 redirects won't work in this case)
Is there something different I need to do when they are logged in? How can I get the cart cleared? Thanks all for the help.