How to add additional order status in Woocommerce?

In this tutorial we’ll learn how to add a custom order status in woocommerce. By default woocommerce comes with a number of shipping options like pending, on hold, completed, failed, refunded etc.

To see full list of available order statuses. Login to admin panel of your site then navigate to orders under woocommerce. Click on an order to edit and there you can see list of available order statuses.

woocommerce

Now let’s say I want to add another order status like “Shipping in Progress”. To do this add the following lines of code at the end of your theme’s functions.php file:

function wpex_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', 'wpex_wc_register_post_statuses' );

 

// Add New Order Statuses to WooCommerce

function wpex_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', 'wpex_wc_add_order_statuses' );

You can access functions.php file here:

woocommerce

Save the file after adding code.

Now again go to order and click on an order to edit from the admin panel.

Here you’ll see the newly added option listed.

woocommerce

Select the newly added option and save order.

Now from the front end go to your account by clicking on My Account link.

Here you’ll see the order status of that order set as ‘Shipping in Progress.’

woocommerce

CHEERS J

Waqas

I hope you enjoy reading this blog post. If you want my team to do WooCommerce Maintenance for you, click here.

Leave a Comment

Your email address will not be published. Required fields are marked *