Black Friday & Cyber Monday SUPER SALE ALL WEEK:
Grab 40% OFF on plugins
Days
Hours
Minutes
Seconds

How to Change the Titles of My Account Page in WooCommerce?

Customizing the titles on your WooCommerce account page is something many people do to make their online store look and feel just right. The ‘My account’ page is where customers deal with their orders, addresses, and account info. Renaming the titles on your WooCommerce account page helps match your brand with your online store. Also, changing the titles of these menus makes it easier for your customers to understand the purpose of the page.

This post will guide you on how to change the titles of an Account Page in WooCommerce.

Where to Add Custom Code in WooCommerce?

It is advisable to add the code snippets to the functions.php file of your child theme. Access the file directly from Appearance->Theme File Editor->Locating the child theme’s functions.php from the right sidebar. You can also access it from your theme’s directory file. Insert the following code snippet in functions.php. The alternative & easy option is to install & activate the Code Snippets plugin. You can then add the code as a new snippet via the plugin.

Solution: Change the Titles of My Account Page in WooCommerce

Imagine that you operate an online fashion store and you want to ensure that your store’s branding is consistent by customizing “My Account” tab menu items. You want to replace the default tab menu items in order to better match your store’s style and focus on the user.

Below are the code snippets to rename the “My Account” tabbed menu items.

add_filter( 'woocommerce_account_menu_items', 'ts_my_account_menu_items', 10, 2 );

function ts_my_account_menu_items( $items ) {
  $items['dashboard'] = __( 'My Profile', 'woocommerce' );
  $items['orders'] = __( 'Order Histroy', 'woocommerce' );
  $items['downloads'] = __( 'My Downloads', 'woocommerce' );
  $items['edit-address'] = __( 'My Addresses', 'woocommerce' );
  $items['edit-account'] = __( 'Profile Settings', 'woocommerce' );
  $items['customer-logout'] = __( 'Sign Out', 'woocommerce' );

  return $items;
}

Output

When the customer clicks on the “My Accounts” tab, they will be redirected to their account page where the tab menu items will get renamed as shown below.

How to Change the Titles of My Account Page in WooCommerce? - Tyche Softwares

In WooCommerce, the “My Account” tab menu items are displayed by default.

How to Change the Titles of My Account Page in WooCommerce? - Tyche Softwares

Code Explanation

Function Hook

The code begins with a function hook using the add_filter function. This hook is used to modify the items in the WooCommerce account menu. Here’s the breakdown:

  • woocommerce_account_menu_items: This is the hook name that specifies the location where the filter is applied. It targets the array of items in the WooCommerce account menu.
  • ts_my_account_menu_items: This is the name of the function that will be called when the filter is applied.
  • 10, 2: These are the priority and accepted arguments for the filter function. The priority (10 in this case) determines the order in which filters are applied, and 2 indicates that the function accepts two arguments.

Function Definition

The ts_my_account_menu_items function is then defined with the following code:

  • $items: This parameter represents the array of items in the WooCommerce account menu that are being filtered.

The function then modifies the items in the menu by updating their labels. Here are the changes:

The labels for some of the default items in the WooCommerce account menu are modified. For example, “dashboard” is changed to “My Profile,” “orders” to “Order History,” and so on.

Recommended Reading: How to Remove Downloads from My Account Page Menu in WooCommerce?

Return statement

This modified array is then used to display the customized items in the WooCommerce account menu.

Conclusion

This code snippet allows you to customize the default WooCommerce account menu items by renaming them to your desired labels. Additionally, if your store exclusively deals with physical products, you can remove the â€śDownloads” menu from the “My Account” page in WooCommerce.

Browse more in: Code Snippets, WooCommerce How Tos, WooCommerce Tutorials

Share It:

Subscribe
Notify of
0 Comments
Newest
Oldest
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x