Menu Close

Steps to Hide Any Link on the My Account Page

WooCommerce offers some great pre-built functionality, especially in regards to user accounts. Many times, you will find yourself customizing the My Account page and its links for various reasons – one common example is removing a link from the menu because it is not relevant to your store. There are actually a couple of really easy ways to do this. The first method is the simplest and is a matter of configuring the WooCommerce settings. The second method involves a bit of code. Both ways will accomplish the same task. So let’s start with the easiest method first.

Configure My Account WooCommerce Settings

This particular method does not require any code and removes both the menu item link and its associated page so we recommend using with this option.

1. Logged in as an Administrator, navigate to WooCommerce > Settings > Advanced.

2. On the Page Setup layer, scroll down to Account Endpoints.

3. If you want to remove the ‘Downloads’ link for example, simply delete the text ‘downloads’ to the right of the Downloads item. Now the Downloads tab is no longer visible to logged in users on the My Account page. See the screenshot below for reference.

Use Code to Remove a My Account Link

If you prefer the code that is associated with removing links from the My Account page, use the following steps below.

1. Logged in as an Administrator, navigate to Appearance > Theme File Editor > Theme Functions (functions.php) on your child theme (do not change code on the parent theme).

2. Scroll to the bottom of the functions.php file and paste the following code at the bottom of the file. Be sure to include or exclude whatever links you would like to remove.

add_filter ( 'woocommerce_account_menu_items', 'mow_remove_my_account_links' );

function mow_remove_my_account_links( $menu_links ){

unset( $menu_links['edit-address'] ); // Addresses

//unset( $menu_links['dashboard'] ); // Remove Dashboard

//unset( $menu_links['payment-methods'] ); // Remove Payment Methods

//unset( $menu_links['orders'] ); // Remove Orders

//unset( $menu_links['downloads'] ); // Disable Downloads

//unset( $menu_links['edit-account'] ); // Remove Account details tab

//unset( $menu_links['customer-logout'] ); // Remove Logout link

return $menu_links;

}

That’s it! Have fun customizing the WooCommerce My Account page!