Orders at a WooCommerce go through several stages from the initial placement to final fulfillment. In order to simplify order tracking, WooCommerce offers several order statuses to make sense of the flow of orders. At the moment, WooCommerce offers the following seven statuses:

  • Completed
  • Processing
  • Pending payment
  • On hold
  • Refunded
  • Cancelled
  • Failed

All these statuses trigger actions that define the store’s business logic for a particular status. You could provide custom code for each status to carry out actions that conform to the store’s policies.

The good thing is that you could define custom order statuses as well and then add custom code so that the store could take the action in response to the selection of the custom status. To demonstrate the process, I will add a custom order status “Shipping In Progress”.

The following code snippets take care of the process. Remember that these snippet will go into functions.php file located in the theme folder.:

Register New Order Status

Add New Order Statuses to WooCommerce

Here’s how the custom order status would look in action:

Code Explanation

The order status that you’re registering through wc-shipping-progress is too long (-22). This will save the first 20 characters of the post status, which makes it invalid and causes errors.

The order statuses are registered as post statuses with a limit of 20 characters. wc-shipping-progress ensures that the limit remains at exactly 20 characters in length.

The wpblog_wc_add_order_statuses() function adds the new custom post status (also known as order status) into the list of available order statuses within the WooCommerce Orders and Edit Orders pages.