In some (not all) cases, I want to set the status of an order to a new custom status after it has been shipped.

Where in the core code is an order updated to complete once it has been invoiced and shipped?

3 Answers 3


You can create a new order status by going to Stores > Configuration > Order Status, and create a new status for that and make sure it is enabled and you'll be able to see your custom generated status under order edit settings.

enter image description here

Now to set your order to custom status whenever it is marked as shipped, you can put an observer event sales_order_save_after, which will execute whenever there is a change in order data, so you need to check the order status in Observer event and if it is changed to shipped code you can override it into your observer execution to your custom status code programmatically.

I hope this will help you. If not, feel free to comment.

  • I knew how to create the new order status, but that does help make it a complete answer. I hadn't considered using an observer to achieve this, I think I was overcomplicating things too much!
    – Geat
    Jun 29, 2020 at 15:13

It turns out using an observer wasn't the optimal solution - another process further down the chain was setting the status back to complete. I also didn't feel that overwriting a previously set status was the most elegant way to achieve what I needed.

I was able to find the method responsible for changing the status of an order after it's set to both shipped and invoiced:


This is called whenever an order's status changes (and in all likelihood is what was reverting the status change from my observer)

By creating an after plugin, I was able to change the status as part of the normal order workflow.

public function afterCheck($subject, $result, $order)
  if ($my_logic) {

It's better to create it via the admin panel by going to Stores > Configuration > Order Status, and ensure to create a new status for it. Don't forget to enable it. I Hope, with this you can see your custom generated status under order edit settings.

  • Yes, I created the order status through the admin system first. I just needed to assign it at certain points in the workflow.
    – Geat
    Jun 30, 2020 at 15:04

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.