2

I have an observer that triggered on sales_order_invoice_pay event, and after creating the invoice, the order status is automatically changed to complete. after that I try to change it to processing but it doesn't work.

is there any way to change the order status after creating the invoice?

below is the code I use to change the status:

$order->setState(\Magento\Sales\Model\Order::STATE_PROCESSING, true);
                    $order->setStatus('processing');
                    $this->_orderRepository->save($order);
  • why do you want to change it back to processing ? you want your order when placed in processing state ? or even after invoicing it should be in processing state ? – Vishwas Bhatnagar Dec 1 '16 at 11:50
  • @VishwasBhatnagar, yes I want to change back to processing after its complete , – Islam Zuhair Dec 1 '16 at 13:15
0

I think this is cover of your requirement.

from admin panel Order statuses cannot be changed, as it disrupts the business logic of Magento itself.

Generally, it’s only possible to cancel, hold and unhold pending orders.

If you want to cancel an order with a ‘Processing’ status or ‘Complete" status you will have to create a credit note for this.

For more info you can look here https://www.mag-manager.com/useful-articles/magento-orders-management/magento-change-order-status-to-any-from-any/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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