How to add a new custom order status to WooCommerce.

If you want a fast and practically free online store, nothing better than WooCommerce, the free WordPress plugin that makes you set up an e-commerce in a few clicks, but it has some small basic shortcomings.

But that is for what we have the fantastic system of WordPress plugins, which cover the spaces not covered by a default installation of WordPress or WooCommerce.

WooCommerce order statuses by default

One of these shortcomings concerns the available order statuses which, by default, are as follows:

  • Pending payment
  • Failed
  • Processing
  • Completed
  • On hold
  • Canceled
  • Refunded
  • Identification required

In addition to these default WooCommerce order statuses, there are others that may appear as you install plugins.

For example, if you install an invoicing plugin a new status of “PDF Invoice Sent” may appear, or if it’s a shipping tracking plugin, some plugins add order statuses like “Pending Shipment”, “Shipped”, “Delivered”, etc.

But what if I want to add a different order status, for tracking issues specific to my online store?

You could look for a plugin that adds just that order status, and helps you in “that” tracking, but you will not always find it, so you have to find a solution, creating a new custom order status, that does not depend on plugins.

How to add a new custom order status to WooCommerce with code.

The first option we have is to solve it with some custom code that creates the new order status and allows us to have this new “tag” for tracking and filtering orders.

The code would look like this example:

/* New order status */ add_action( 'init', 'wphelp_new_order_status_sent' ); function wphelp_new_order_status_sent() { register_post_status( 'wc-sent', array( 'label' => _x( 'Sent', 'Order status', 'woocommerce' ), 'public' => true, 'exclude_from_search' => false, 'show_in_admin_all_list' => true, 'show_in_admin_status_list' => true, 'label_count' => _n_noop( 'Sent <span class="count">(%s)</span> ', 'Sent <span class="count">(%s)</span>', 'woocommerce' ) ) ); } // Add it to wc_order_statuses. add_filter( 'wc_order_statuses', 'wphelp_order_sent' ); function wphelp_order_sent( $order_statuses ) { $order_statuses['wc-sent'] = _x( 'Sent', 'Order status', 'woocommerce' ); return $order_statuses; } // Add the order status to bulk actions in the order we want function rename_or_reorder_bulk_actions( $actions ) { $actions = array( 'trash' => $actions['trash'], //Send to thrash 'mark_processing' => $actions['mark_processing'], //Processing 'mark_on-hold' => $actions['mark_on-hold'], //On hold 'mark_cancelled' => $actions['mark_cancelled'], //Cancelled 'mark_completed' => $actions['mark_completed'], //Completed 'mark_sent' => __( 'Change to sent', 'textdomain' ), // New order status ); return $actions; } add_filter( 'bulk_actions-edit-shop_order', 'rename_or_reorder_bulk_actions', 20 );
Code language: PHP (php)

This code consists of 3 parts:

  1. Creation of the new order status to be available when editing an order.
  2. Registering the new order status in the order status table
  3. Adding a bulk action to be able to switch to the new order status from the order list as well.

From this code you must change the texts that identify the new order status name (Shipped), as well as the status array (wc-shipped), if you want.

Where do I have to add this code?

If you have never added a custom code to your WordPress installation here is a simple and quick guide with several methods to do it:

How and where to paste PHP, JS, CSS codes and functions you find around in WordPress

How to add a new custom order status to WooCommerce with plugins.

If you don’t feel like using a simple code like the previous one, you can always resort to plugins that make the task easier.

Custom Order Status for WooCommerce

This free plugin allows you to easily create, modify and delete new custom order statuses, for which you can edit:

  • The slug of the custom order state.
  • The label (visible name) of the custom order status.
  • The icon of the custom order status.
  • The icon and color of the custom order status column.

To do this, you have a simple interface, in which you can create new custom order statuses.

custom order status for woocommerce plugin settings

As it is a free version it does not allow you to customize emails or order statuses by default but as far as new custom order statuses are concerned you can easily create and modify them to your liking.

How useful was this post?

Click on a smiley to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

Leave a Comment

Your email address will not be published.

Scroll to Top
Skip to content