Rename Completed order status in WooCommerce

I had a task from a client to rename the default WooCommerce order status from the original to a custom name.

The client wanted to rename ‘Completed’ status in WooCommerce, to a new status ‘Dispatched’, as once the order has been sent out, they wanted it a little clearer that it was sent, rather than a general ‘Completed’.

Luckily, WooCommerce has a filter hook available which we can use to hook in to the text, rename it and override the original. Here’s how:

add_filter( 'wc_order_statuses', 'wc_renaming_order_status' );
function wc_renaming_order_status( $order_statuses ) {
    foreach ( $order_statuses as $key => $status ) {
        if ( 'wc-completed' === $key )
            $order_statuses['wc-completed'] = _x( 'Dispatched', 'Order status', 'woocommerce' );
    }
    return $order_statuses;
}

Note, you can rename Dispatched in the above snippet to anythnig you wish.

Other Order Statuses

And if you want to edit any other statuses, you can use any of the following:

function wc_get_order_statuses() {
  $order_statuses = array(
    'wc-pending'    => _x( 'Pending payment', 'Order status', 'woocommerce' ),
    'wc-processing' => _x( 'Processing', 'Order status', 'woocommerce' ),
    'wc-on-hold'    => _x( 'On hold', 'Order status', 'woocommerce' ),
    'wc-completed'  => _x( 'Completed', 'Order status', 'woocommerce' ),
    'wc-cancelled'  => _x( 'Cancelled', 'Order status', 'woocommerce' ),
    'wc-refunded'   => _x( 'Refunded', 'Order status', 'woocommerce' ),
    'wc-failed'     => _x( 'Failed', 'Order status', 'woocommerce' ),
  );
  return apply_filters( 'wc_order_statuses', $order_statuses );
}

Useful post? Share it

4 comments on “Rename Completed order status in WooCommerce

  1. Wow, I have been looking for this code for a long time! It’s perfect, thank you. I needed to change status from “on hold” to “Payment pending”. Thank you so much Phil!!!

Leave a Reply

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