Image default

How To Add WooCommerce Custom Order Status

WooCommerce orders go through several steps from the initial process to final checkout. In order to simplify this complex process for order tracking, WooCommerce offers order statuses to make a proper flow of orders. These are the seven WooCommerce order statuses.

  1. Completed
  2. Processing
  3. Pending payment
  4. On hold
  5. Refunded
  6. Cancelled
  7. Failed

All of these WooCommerce order statuses trigger actions that describe the online store’s business logic for a particular order status.

The best thing is that you could define your own custom order status and add custom code so that the online store take right action in order to the selection of the custom status. Here I am going to add a custom order status “Shipping In Progress”.

Add the following code snippets into functions.php file located in the theme folder.:

Registering New Custom Order Status

function wpitech_wc_register_post_statuses() {
register_post_status( 'wc-shipping-progress', array(
'label' => _x( 'Shipping In Progress', 'WooCommerce Order status', 'text_domain' ),
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Approved (%s)', 'Approved (%s)', 'text_domain' )
) );
add_filter( 'init', 'wpitech_wc_register_post_statuses' );

Add New Custom Order Statuses to WooCommerce

function wpitech_wc_add_order_statuses( $order_statuses ) {
$order_statuses['wc-shipping-progress'] = _x( 'Shipping In Progress', 'WooCommerce Order status', 'text_domain' );
return $order_statuses;
add_filter( 'wc_order_statuses', 'wpitech_wc_add_order_statuses' );

Here is the preview of how the custom order status would look in action:

How custom order status look like

The wpitech_wc_add_order_statuses() function adds a new custom post status that is known as order status in the list of available order statuses within the WooCommerce Orders pages.


Related posts

How To Hide or Disable Add To Cart Button In WooCommerce Store


Show Category in WooCommerce Product Loop


How to Setup WooCommerce Deposits for Store Product