Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the titles on My Account pages in Woocommerce

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

like image 449
alexkodr Avatar asked Nov 22 '18 21:11

alexkodr


People also ask

How do I change the page title in WooCommerce?

The easiest way to change the WooCommerce shop page title is by using the built-in WordPress settings. To do so, navigate to Pages > All Pages from your WordPress dashboard. Find the 'Shop – Shop Page' and click the Edit button. You can then change your shop page title as shown below.

How do I change page title in WordPress?

To modify the title tag of your index page, log in to the WordPress admin area and go to Settings > General. On this page, edit the Site Title field and save the changes. By default WordPress doesn't allow you to have a custom title for each post or page you create – just for your home page.


1 Answers

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.

enter image description here

like image 73
LoicTheAztec Avatar answered Sep 28 '22 01:09

LoicTheAztec