I want to change the WooCommerce dashboard widget title from 'WooCommerce Status' to something else.

I understand that I need to use a hook in my functions.php but I'm struggling to make this work.

I've found the function and the file in WooCommerce that is generating the dashboard widget ( plugins/woocommerce/includes/admin/class-wc-admin-dashboard.php ) - and I've attempted to use add_action to hook into this function but to no avail unfortunately, it either does nothing or throws an error.

I am able to create a completely new dashboard widget but that is not what I need.

I've referenced several answers and tutorials such as this one which comes close ( https://www.tychesoftwares.com/understand-wordpress-dashboard-widget-create-custom-dashboard-widget-woocommerce/ ).

I know this should be very simple but I've not enough experience with hooks and filters to be able to pull this off - would appreciate any assistance!

1 Answers

0
LoicTheAztec On Best Solutions

Try the following instead:

add_filter(  'gettext',  'change_add_to_cart_message', 10, 3 );
function change_add_to_cart_message( $translated, $text, $domain  ) {
    global $pagenow;
    if( $text === 'WooCommerce status' && $domain === 'woocommerce' && is_admin() && $pagenow === 'index.php' ){
        $translated = __( 'WooCommerce summary', $domain );
    }
    return $translated;
}

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

enter image description here