Home » WooCommerce: Hide or Rename a My Account Tab

WooCommerce: Hide or Rename a My Account Tab

by Tutor Aspire

Many WooCommerce websites don’t need the “Downloads” tab in the My Account page. Or maybe the “Addresses” tab needs to be renamed into something more user-friendly 🙂

Well, here are 2 super simple snippets to hide or rename any tabs you have in the My Account page, including custom tabs that are added by plugins such as Account Funds, Subscriptions, and so on.

Simply note down the URL of the tab e.g. “edit-account” (see image) and edit the snippets accordingly. Enjoy!

Hide or Rename a My Account Tab – WooCommerce

PHP Snippet: Hide or Rename a My Account Tab – WooCommerce

/**
* @snippet       Hide Edit Address Tab @ My Account
* @how-to        Get tutoraspire.com FREE
* @author        Tutor Aspire
* @testedwith    WooCommerce 5.0
* @donate $9     https://www.tutoraspire.com
*/

add_filter( 'woocommerce_account_menu_items', 'tutoraspire_remove_address_my_account', 9999 );

function tutoraspire_remove_address_my_account( $items ) {
   unset( $items['edit-address'] );
   return $items;
}

/**
* @snippet       Rename Edit Address Tab @ My Account
* @how-to        Get tutoraspire.com FREE
* @author        Tutor Aspire
* @testedwith    WooCommerce 5.0
* @donate $9     https://www.tutoraspire.com
*/

add_filter( 'woocommerce_account_menu_items', 'tutoraspire_rename_address_my_account', 9999 );

function tutoraspire_rename_address_my_account( $items ) {
   $items['edit-address'] = 'Delivery Address';
   return $items;
}

If you need the full list of default account menu item keys, here they are:

$items = array(
'dashboard'       => __( 'Dashboard', 'woocommerce' ),
'orders'          => __( 'Orders', 'woocommerce' ),
'downloads'       => __( 'Downloads', 'woocommerce' ),
'edit-address'    => _n( 'Addresses', 'Address', (int) wc_shipping_enabled(), 'woocommerce' ),
'payment-methods' => __( 'Payment methods', 'woocommerce' ),
'edit-account'    => __( 'Account details', 'woocommerce' ),
'customer-logout' => __( 'Logout', 'woocommerce' ),
);

If PHP fails… Remove an Endpoint from WooCommerce Settings

Go to WordPress Dashboard > WooCommerce > Settings > Advanced, and look for “Account endpoints”.

For example, the official Memberships plugin adds a “Memberships” tab to your My Account page which is controlled by the endpoint “members-area”.

Delete this endpoint from the text input field, click on “Save changes”, flush your permalinks, and the “Memberships” tab will be deleted. Be really careful with these endpoints, and only delete them if you know what you’re doing.

Delete an account endpoint in order to hide a My Account tab on the frontend

Is There a (Reliable) Plugin For That?

If you’d love to code but don’t feel 100% confident with PHP, I decided to look for a reliable plugin that achieves the same result.

In this case, I recommend the YITH WooCommerce Customize My Account Page plugin. On top of removing or renaming My Account tabs, you can also move the tab menu around, customize the color scheme, add banners, set up reCaptcha on the register and login forms, sort and group tabs, conditionally show tabs to a given user role and much more.

But in case you hate plugins and wish to code (or wish to try that), then keep reading 🙂

You may also like