I want to create order from quote id . I am using this code but order is not getting created

$quote = Mage::getModel('sales/quote')->load(94251);
$convertQuote = Mage::getSingleton('sales/convert_quote'); 
$order = $convertQuote->toOrder($quote);

I get error that Credit card number mismatch with credit card type. payment method already store in quote. payment method is authnetcim.

  • pls try my answer and let me know it works or not. Commented Oct 20, 2016 at 11:28
  • Anyone have solution for this?? Commented Oct 30, 2017 at 3:22

2 Answers 2


Try something like below :

$store = Mage::getSingleton('core/store')->load(1);

$quote = Mage::getModel('sales/quote')->setStore($store)->load(94251);


$convert = Mage::getModel('sales/convert_quote');
$order = $convert->toOrder($quote)

foreach ($quote->getAllItems() as $quoteItem) {
    $orderItem = $convert->itemToOrderItem($quoteItem);
    if ($quoteItem->getParentItem()) {

  • it not works. no any order createa Commented Oct 20, 2016 at 12:05
  • and i not want to store any static information when create order Commented Oct 20, 2016 at 12:05

Here is the script:

$quote = Mage::getModel('sales/quote')->load(5428);

$convert = Mage::getModel('sales/convert_quote');

$order = $convert->toOrder($quote);

foreach($quote->getAllItems() as $item){
    $orderItem = $convert->itemToOrderItem($item);
    if ($item->getParentItem()) {


$payment = $quote->getPayment();

$payment = $convert->paymentToOrderPayment($quote->getPayment());


$message = '[Notice] - Order converted from quote manually';
$order->addStatusToHistory($order->getStatus(), $message);


Other solution:-

Have you tried the toOrder Method?



$convertQuote = Mage::getSingleton('sales/convert_quote'); $order = $convertQuote->toOrder($quote);
  • in quote there is all information store already. so no any static info store. Commented Oct 21, 2016 at 3:35
  • Your "other solution" is just the beginning bit of your main solution. It's also the same as what jigs tried already, as shown in his question. Commented Dec 7, 2017 at 15:23
  • And where does $data come from in the line $payment->importData($data);? Commented Dec 7, 2017 at 15:44

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.