Renaming WooCommerce Order Status

21,124

Solution 1

Just renaming order status "Completed" to "Order Received", it's easy and can be accomplished this way with wc_order_statuses hook (you will paste this snippet in your active child theme function.php file):

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( 'Order Received', 'Order status', 'woocommerce' );
    }
    return $order_statuses;
}

Code goes in function.php file of your active child theme (or active theme). Tested and Works.

Update 2018 - To rename, in Order list page:
• the bulk actions dropdown
• the order status tabs (with the count)
See: Rename multiple order statuses in Woocommerce

Other related reference: How to create a custom order status in woocommerce

Solution 2

The accepted answer does a good job in most places, but the order status filter on the main order page is unaffected, as mentioned in one of the comments.

To update this you must also hook into the filter woocommerce_register_shop_order_post_statuses and update label_count like so:

// Rename order status 'Completed' to 'Order Received' in admin main view - different hook, different value than the other places
function wc_rename_order_status_type( $order_statuses ) {
    foreach ( $order_statuses as $key => $status ) {
        $new_order_statuses[ $key ] = $status;
        if ( 'wc-completed' === $key ) {
            $order_statuses['wc-completed']['label_count'] = _n_noop( 'Order Received <span class="count">(%s)</span>', 'Order Received <span class="count">(%s)</span>', 'woocommerce' );
        }
    }
    return $order_statuses;
}
add_filter( 'woocommerce_register_shop_order_post_statuses', 'wc_rename_order_status_type' );

You will also need to update the string in the 'Bulk Actions' dropdown. Hooking into WordPress' gettext filter let's you do it, like so:

// Rename order status in the bulk actions dropdown on main order list
function rename_bulk_status( $translated_text, $untranslated_text, $domain ) {
    if( is_admin()) {
        if( $untranslated_text == 'Change Status To completed' )
            $translated_text = __( 'Change Status To Order Received','woocommerce' );
    }
    return $translated_text;
}

add_filter('gettext', 'rename_bulk_status', 20, 3);

So add these to the accepted answer above so you have all 3 functions.

Solution 3

I had a similar wish, but for some reason Loic's solution did not work with my shop. So I want to share my simple solution.

With the free plugin LocoTranslate you can easily rename the order status for your language. If your page needs no translation (i.e. it is in English), it might still be handy.

Simply create a totally new translation file and enter only the new order status replacing the original name. All other terms are not affected by this language file, if the fields stay empty (don't forget to activate this pseudo-translation in page settings).

This way, there is a good chance that WooCommerce updates will not affect it.

Share:
21,124
Kevin
Author by

Kevin

Updated on November 13, 2021

Comments

  • Kevin
    Kevin over 2 years

    I would like to rename the WooCommerce order status from "Completed" to "Order Received". I can edit the script below located in wc-order-functions.php, but I would prefer not to modify any core files or use a plugin.

    Is it possible to override woocoomerce functions with scripts in child theme's functions.php file?

    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 );
    }
    
  • Kevin
    Kevin almost 8 years
    I first received an error message, but I made a small change and that did the trick. I had to change the ending "," to a ";" on: $order_statuses['wc-completed'] = _x( 'Order Received', 'Order status', 'woocommerce' ); Thanks!
  • LoicTheAztec
    LoicTheAztec almost 8 years
    @Kevin Ah yes sorry a typo… I have update my answer then… thanks :)
  • Karolína Vyskočilová
    Karolína Vyskočilová almost 7 years
    @LoicTheAztec works great, however, I can't figure out how to show the renamed name in the list of available statuses under "Order" title there are All (15) | On Hold (10) etc. but the title is not renamed, any ideas how to fix it?
  • dansch
    dansch over 6 years
    Uh, does your code need the line about $new_order_statuses, or even the loop altogether? If you only have the line that renames wc-completed, would it still work? Maybe out of order. Otherwise, the new_order_statuses line looks obsolete, unless you create and return that array.
  • LoicTheAztec
    LoicTheAztec almost 6 years
    To everybody, for a more complete and overall answer related to order status rename see: Rename multiple order statuses in Woocommerce