I am creating a duplicate order that has been previously placed by a specific customer. How can I set the same billing and shipping address on the new order that I am creating programatically?


You can load any data from the existing order object.

$order = Mage::getModel('sales/order')->load($oldOrderId);

Another way would be to use the old orders quote

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


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

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



1. got the code from an old script, didn't test it and might need some debuggen here and there

2. if you have the quote cleanup cron working quotes will be thrown away after 30 days so can't be loaded

|improve this answer|||||

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.