resultRedirectFactory->create(); if (!$this->isValidPostRequest()) { $this->messageManager->addErrorMessage(__('Can\'t unhold order.')); return $resultRedirect->setPath('sales/*/'); } $order = $this->_initOrder(); if ($order) { try { if (!$order->canUnhold()) { throw new \Magento\Framework\Exception\LocalizedException(__('Can\'t unhold order.')); } $this->orderManagement->unHold($order->getEntityId()); $this->messageManager->addSuccessMessage(__('You released the order from holding status.')); } catch (\Magento\Framework\Exception\LocalizedException $e) { $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addErrorMessage(__('The order was not on hold.')); } $resultRedirect->setPath('sales/order/view', ['order_id' => $order->getId()]); return $resultRedirect; } $resultRedirect->setPath('sales/*/'); return $resultRedirect; } }