0

I want to set orders status pending in magento 2.4.

Please help me

THANKS.

1
  • Is there any third party related to that installed? Commented Jun 14, 2021 at 3:55

1 Answer 1

0
 $orderId = 1; // here order id

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

OR

public function __construct(
    \Magento\Sales\Model\Order $order
){
    $this->order = $order;
}
public function updateorder(){
    $order = $this->order->load($orderId);
    $order->setStatus(\Magento\Sales\Model\Order::STATE_PROCESSING);
    $order->save();
}
7
  • i want to set orders status pending. Commented Jun 13, 2021 at 12:10
  • check the updated answer
    – Asad Ullah
    Commented Jun 13, 2021 at 12:13
  • online payment order status pending now working but after sometime how to set in processing status in admin side. Because in admin side not showing in options. So Please help me how to set in processing admin sale > order > view Commented Jun 13, 2021 at 12:19
  • if this answer kindly upvote....and after sometime when you need to change status from pending to processing?
    – Asad Ullah
    Commented Jun 13, 2021 at 12:21
  • yes i have ship order but still status are showing pending. Commented Jun 13, 2021 at 12:23

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.