Hi,
I know that there is a possibility that we could find some articles on the internet with this thematic, but let me add my own version.
Programmatic Un-Canceling orders should not be the best way to resolve the issues with an order canceled by mistake.
It is more recommended to re-create the order from the admin instead (if possible). But there are some specific situations in which we really need to do this, so let’s get to the code:
//... $order = Mage::getModel('sales/order')->loadByIncrementId($incrementId); $order->setSubtotalCanceled(null); $order->setBaseSubtotalCanceled(null); $order->setTaxCanceled(null); $order->setBaseTaxCanceled(null); $order->setShippingCanceled(null); $order->setBaseShippingCanceled(null); $order->setDiscountCanceled(null); $order->setBaseDiscountCanceled(null); $order->setTotalCanceled(null); $order->setBaseTotalCanceled(null); $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, 'pending_payment', 'This order is uncanceled by Admin!'); $order->setStatus(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT); $order->save(); //Don't forget to un-cancel order items ... foreach ($order->getAllItems() as $item) { $item->setQtyCanceled(0); $item->save(); } //...