[email protected]

How To Add Custom WooCommerce order statuses

May 3, 2024

woocommerce custom order status

I’ve been working with a couple of clients recently who needed custom order statuses for their WooCommerce orders.

Custom order status are usually used to show the work flow of an order as it is moved through the fullfilment process.

In this video tutorial I’ll show you how to add those custom statues.

Code

Add the following code to your functions.php file or use the code snippets plugin as I do.

Change the labels (marked in bold) to match the names of the order statuses you need.


function register_custom_order_statuses() {
    register_post_status('wc-awaiting-pickup', array(
        'label'                     => _x('Awaiting Pickup', '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('Awaiting Pickup <span class="count">(%s)</span>', 'Awaiting Pickup <span class="count">(%s)</span>', 'text_domain')
    ));
    
    register_post_status('wc-shipped', array(
        'label'                     => _x('Shipped', '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('Shipped <span class="count">(%s)</span>', 'Shipped <span class="count">(%s)</span>', 'text_domain')
    ));
}

add_action('init', 'register_custom_order_statuses');

function add_custom_order_statuses_to_woocommerce($order_statuses) {
    $order_statuses['wc-awaiting-pickup'] = _x('Awaiting Pickup', 'Order status', 'text_domain');
    $order_statuses['wc-shipped'] = _x('Shipped', 'Order status', 'text_domain');

    return $order_statuses;
}

add_filter('wc_order_statuses', 'add_custom_order_statuses_to_woocommerce');

Video Tutorial

Here’s a video tutorial to show the code in action

Wrap Up

If you need help setting up custom statuses on your WooCommerce store, head over to my services page to get a no obligation quote.

Article by GeneratePress

Lorem ipsum amet elit morbi dolor tortor. Vivamus eget mollis nostra ullam corper pharetra torquent auctor metus. Natoque tellus semper taciti nostra primis lectus donec tortor semper habitant taciti primis tempor montes.