TransWikia.com

Restore cancelled order in magento 2

Magento Asked by Asad Mazhar on December 26, 2021

How to restore order that have been cancelled.i’m having problems restoring cancelled-orders and recovering purchase request from order view page.is there any extension which can help me resolve this problem?

One Answer

And if you want try to restore cancelled order by specific order id, you can try with below code:

$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$order = $objectManager->get('MagentoSalesModelOrder')->load(162); //162 is your order id

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

$orderItems = $order->getAllItems();
foreach ($orderItems as $item) {
    $item->setData("qty_canceled",0)->save();
}

Hope this solution will help you!

Answered by Faisal Sheikh on December 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP