In my last post, we looked at how to add a brand new custom order status in WooCommerce.
Sometimes though, you may not need to make a new status, but just rename an existing status.
Depending on the business, there may be more appropriate names for certain order statuses. For example, you may want to change the order status name “Processing” to “Reviewing”, or change “Pending” to “Waiting”.
Example: Rename the “Processing” Order Status
In this example snippet, I will simply rename the “Processing” order status to “Reviewing”.
We will use the filter hook wc_order_statuses
, which provides an array of the current order statuses to modify.
function rename_order_statuses( $order_statuses ) { $order_statuses['wc-processing'] = _x( 'Reviewing', 'Order status', 'woocommerce' ); // rename "Processing" to "Reviewing" /* other examples to change */ // $order_statuses['wc-pending'] = _x( 'Undecided', 'Order status', 'woocommerce' ); // rename "Pending" to "Undecided" //$order_statuses['wc-on-hold'] = _x( 'Delayed', 'Order status', 'woocommerce' ); // rename "On-hold" to "Delayed" //$order_statuses['wc-completed'] = _x( 'Finished', 'Order status', 'woocommerce' ); // rename "Completed" to "Finished" //$order_statuses['wc-failed'] = _x( 'Unsuccessful', 'Order status', 'woocommerce' ); // rename "Failed" to "Unsuccessful" //$order_statuses['wc-refunded'] = _x( 'Returned', 'Order status', 'woocommerce' ); // rename "Refunded" to "Returned" //$order_statuses['wc-cancelled'] = _x( 'Aborted', 'Order status', 'woocommerce' ); // rename "Cancelled" to "Aborted" } add_filter( 'wc_order_statuses', 'rename_order_statuses', 10, 1 );
The _x()
syntax is a function used by WordPress for translations. If you don’t need this, you could just simply write $order_statuses['wc-processing'] = 'Reviewing';
That’s it! 😃