1

When a user checks out, the quote is becoming null, and the ID becomes 0.

This is causing a problem because the next time I'm calling

cart = Mage::getSingleton('checkout/cart');

and using the cart object to add a product to the cart, it's not saving after I call cart->save(). What's weird is, the second time that I call the url to add the cart, it actually saves correctly. How can I properly initialize the cart if the quote is null so that it saves properly from the first time I try to add a product?

1 Answer 1

2

Have you tried init?

$cart = Mage::getSingleton('checkout/cart');
$cart->init();
3
  • I have, yes. It had no effect..
    – Pat
    Commented Nov 19, 2015 at 7:58
  • Seems to work. I had to clean previous carts for that to work. Thank you.
    – Pat
    Commented Dec 2, 2015 at 11:30
  • Mage::getSingleton('checkout/cart')->save() work for me :)
    – Alex
    Commented Jul 19, 2016 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.