I can successfully convert convert an order into quote but I still couldn't load it into current cart. I tried several methods but to no avail. Here's the simplest one:

$_quote = Mage::getModel('sales/convert_order')->toQuote($order)->save();
$_quote = Mage::getModel('sales/quote')->load($_quote->getId());

I was able to get the quote ID but the quote object doesn't load to the current cart.

I also tried

$_quote = Mage::getModel('sales/convert_order')->toQuote($order)->save();
$_quote = Mage::getModel('sales/quote')->load($_quote->getId());

if ($_checkoutQuote->getId() != $_quote->getId() && $_quote->getId()) {

and similar approaches but still not loading the quote. Thank you very much!



Please use the below code. It will may help you.


Code convert an order to quote please used below:

   $quote = Mage::getModel('sales/quote')->load($order->getQuoteId());
    if ($quote->getId()) {
           // ->unsLastRealOrderId();

Here the process:

Get Current quote


Convert Order to quote

$OrderQuote = Mage::getModel('sales/quote')->load($order->getQuoteId());

Active Quote

if ($OrderQuote>getId()) {

Merge your current quote and order reverse Quote

if ($OrderQuote->getId() && $currenQuoteId != $OrderQuote->getId()) {
    if ($currenQuoteId) {

set quote to checkout session


 if (Mage::getSingleton('checkout/session')->_quote) {
       Mage::getSingleton('checkout/session') = $OrderQuote;
    } else {
  • Y? what down? please anybody tell us?
    – Keyul Shah
    Nov 7 '14 at 7:29
  • No idea how it was downvoted. But I also checked if it would work, unfortunately it didn't do the trick. Nov 7 '14 at 7:34
  • @KeyulShah,I did not know why some people are down vote without any reason
    – Amit Bera
    Nov 7 '14 at 7:35
  • @AmitBera : hmm Better Luck Next time.
    – Keyul Shah
    Nov 7 '14 at 7:37

The previous answer only works if the quote is still available in the DB. I ran into a situation where this was no longer the case, so this code doesn't work:

$quote = Mage::getModel('sales/quote')->load($order->getQuoteId());
$quote->getId() => This is empty, in fact the whole model is empty!

Instead, we can use the Mage_Sales_Model_Convert_Order to convert an existing order back into a new quote using the toQuote(Mage_Sales_Model_Order $order) method. It takes an order as input and outputs a new quote object.

You do need to call extra functions for converting the billing/shipping address, items, etc. For each object you will find a function in this class.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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