I’ve seen loads of example of how to re-order / change the navigation and page with the WooCommerce my account dashboard. But i can’t for the life of me work out how to change the main titles for each section (My Account, Orders, Downloads, Addresses etc).
I’ve searched through the templates but no joy. I’ve tried using conditional php comments to echo the titles for the correct page. But it doesn’t work because my account section uses endpoints. I’ve tried adding a filter, but no joy. Anyone got any idea how i change these titles?
Thanks
Advertisement
Answer
It can be done using the composite filter hook woocommerce_endpoint_{$endpoint}_title
.
For example if you need to change the My Account “** Account details**” title you will use (where the endpoint is edit-account
):
add_filter( 'woocommerce_endpoint_edit-account_title', 'change_my_account_edit_account_title', 10, 2 ); function change_my_account_edit_account_title( $title, $endpoint ) { $title = __( "Edit your account details", "woocommerce" ); return $title; }
Code goes in function.php file of your active child theme (or active theme). Tested and works.