how do i set order status as 'complete' manually.
I am using the following code, but its giving error saying, The Order State 'complete' must not be set manually.
$order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
$order->setState(Mage_Sales_Model_Order::STATE_COMPLETE);
$order->save();
i found a solution for my self,
$order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
$order->setData('state', "complete");
$order->setStatus("complete");
$history = $order->addStatusHistoryComment('Order was set to Complete by our automation tool.', false);
$history->setIsCustomerNotified(false);
$order->save();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With