Bumped by Community user
    Bumped by Community user
2 improved formatting
source | link

I have an observerobserver that triggered on sales_order_invoice_pay eventsales_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: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);

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);

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);
1
source | link

Magento 2 - Change Order status after invoicing

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);