How to Order status change Processing to complete in magento 2.3

4 Answers 4


You can Change status this way..

    $orderId = 1; // here order id

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


  • can u please help me solve this issue @rakesh Commented Feb 18, 2019 at 10:07

You can Change the order status to complete using repository Class of order entity \Magento\Sales\Api\OrderRepositoryInterface

    $order = $this->orderRepository->get($orderiId);

Code Looks Like:

namespace {ClassNameSpace};

use Magento\Framework\Exception\NoSuchEntityException;

class Test {

     * @var \Magento\Sales\Api\OrderRepositoryInterface
    private $orderRepository;

    public function __construct(
    \Magento\Sales\Api\OrderRepositoryInterface $orderRepository      
    ) {

        $this->orderRepository = $orderRepository;
    public function ChangeOrderStatusToComplete()
        $completeStatus = \Magento\Sales\Model\Order::STATE_COMPLETE;
        $id = 2;
            $order = $this->orderRepository->get($id);
        } catch (NoSuchEntityException $ex) {
            // error Happen

  • 1
    Sir If I want to change it Hold to Processing how can we set it on Processing or any other status??? like in your code it is only for Complete.
    – Asad Khan
    Commented Sep 18, 2019 at 13:29
  • @Amit How does this work? i have a user and the order id = 2 how does this update it? how do i run it Commented Nov 21, 2019 at 16:30
  • Once payment is done, the order status showing as "Processing" by default but I wanted to show as "Pending/New" similar to "Cash On Delivery". If I want to set the order status as "Pending/New" programmatically once the order is placed. What should I do? Please advise.
    – Vinayagam
    Commented Jan 14, 2020 at 15:04

This is duplicated from this Link

use Magento\Sales\Model\Order;

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

kindly change object manager to di

 $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
            $orderRepository = $objectManager->create('\Magento\Sales\Api\OrderRepositoryInterface');
            $order = $orderRepository->get($orderId);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.