Mr. Jo
Mr. Jo

Reputation: 5251

Rename order status from filter menu from Admin Orders list in Woocommerce

How can I rename and add quick filters to the WooCommerce orders overview:

enter image description here

I've did some research but can't found a solution which I can understand as a beginner in WooCommerce. I already know how to add custom order states so I think it's also very simple because my custom states already exists.

The "Tested" one in the menu has already the name because I've renamed a WooCommerce order status to this name.

Upvotes: 1

Views: 767

Answers (1)

LoicTheAztec
LoicTheAztec

Reputation: 253784

To Rename "fertiggestellt" (Completed) order status in Admin Order list order statuses tab menu use the following:

add_filter( 'gettext', 'rename_woocommerce_order_status', 10, 3 );
add_filter( 'ngettext', 'rename_woocommerce_order_status', 10, 3 );
function rename_woocommerce_order_status( $translated, $text, $domain ) {

    if ( strpos($text, 'Completed') !== false ) {
        $translated = str_replace('Processing', 'Custom text', $text );
    }

    if ( strpos($translated, 'fertiggestellt') !== false ) {
        $translated = str_replace('fertiggestellt', 'Custom text', $translated );
    }

    return $translated;
}

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

enter image description here


Upvotes: 1

Related Questions