Magento 2 Change Order Status Programmatically

How to change the Magento 2 order status programmatically

You can use “setState” to change the status of an order.

$orderId = 1;

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$order = $objectManager->create('\Magento\Sales\Model\Order')
                           ->load($orderId); 

$order->setState("processing")->setStatus("processing");

$order->save();
0 0 votes
Article Rating
Subscribe
Notify of
guest
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
jaswinder singh
jaswinder singh
7 years ago

In the last you need to save order.
$order->save();