Skip to content
NewRedesigned blogFeedback
Jigar Karangiya

How to Change Order Status Programmatically in Magento 2

Hello Magento Devs, All orders have an order status that is associated with a stage in the order processing workflow.

Written by
JKJigar Karangiya
Published
Reading time
1 min read

Jigar Karangiya · · 1 min read

Hello Magento Devs,

All orders have an order status that is associated with a stage in the order processing workflow (opens in new tab).

In this tutorial we are going to see how we can change order status programatically instead of doing it manually.

php
$orderId = 11111; //your order id here
$objManager = \Magento\Framework\App\ObjectManager::getInstance();
$order = $objManager->create('\Magento\Sales\Model\Order') ->load($orderId);
$newState = Order::STATE_PROCESSING;
$order->setState($newState)->setStatus(Order::STATE_PROCESSING);
$order->save();

Here are some default magento 2 order states which you can use in set Order State and Order Status:

Table 01
States & StatusesValue
STATE_NEWnew
STATE_PENDING_PAYMENTpending_payment
STATE_PROCESSINGprocessing
STATE_COMPLETEcomplete
STATE_CLOSEDclosed
STATE_CANCELEDcanceled
STATE_HOLDEDholded
STATE_PAYMENT_REVIEWpayment_review
STATUS_FRAUD (Only Used for Order Status)fraud

That’s it.

You can read more about order status and states in magento 2 documantation page at Order Status (opens in new tab).

If you need help with this solution, feel free to ask in the Comments section below.

I would be happy to solve your queries.

(opens in new tab)

Keep reading
All posts

01 · 10 min · Shares Adobe Commerce Core

Adobe Commerce Agentic Capabilities, Q4 2026

Five agentic releases for Adobe Commerce: LLM product discovery, Brand Visibility, the Shopper MCP server, Brand Concierge, and Experience Workspace. What each one does, which editions get it, and when.

10 min

03 · 3 min · Shares Adobe Commerce Core

Conditions for Collections in Magento 2

Collections in Magento 2 (Now Adobe Commerce), are among the most powerful tools for retrieving and manipulating data directly from the database.

3 min

Newsletter

New Magento tutorials, straight to your inbox

Code examples, performance tips, and fixes for common Magento issues. No spam.

Subscribe