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);
  • 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 ? Dec 1, 2016 at 11:50
  • @VishwasBhatnagar, yes I want to change back to processing after its complete , Dec 1, 2016 at 13:15

2 Answers 2


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/


Although I know that this question is quite old, I had the same issue: Orders, which only consists of virtual products will be set automatically to complete (if payed or if an invoice is created). This is due to a Class/method within Magento-Core:


public function check(Order $order)
  // functionality to set non-shippable orders to complete, instead of processing.

I solved it by creating a small module, which has a Plugin for that class and which replaces the functionality. Then those specific orders will be set to the Status "Processing" instead of "Complete" and I could build my own custom workflow around it.

Here is the Module. Feel free to fork it: https://github.com/espressobytes/m2-order-status-flow

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.