How to Hide Any Tab My Account Page WooCommerce

Hide Any Tab My Account PageThe WooCommerce My Account page should have a good design because it is vital for smooth operation in the store. Customers in your store can use this page to make the most of the account management. Therefore, customizing this page is important to convert more sales or entice customers to return to your store.

WooCommerce Hide Any Tab My Account Page

This page is an actual page that contains a WooCommerce shortcode. You can use this shortcode to display the default yet complex account management tabs and their unique content on any page.

In this brief tutorial, you will learn how to hide any My Account page tab using a custom PHP code snippet. If you are familiar with PHP customization, almost anything can be achieved with simple snippets.

Steps to Hide Any Tab on the My Account Page

By default, the WooCommerce account page looks like this:My account page

Here are the steps that you need to follow:

  1. Log into your WordPress site and access the Dashboard as the admin user.
  2. From the Dashboard menu, click on Appearance Menu > Theme Editor Menu. When the Theme Editor page is opened, look for the theme functions file to hide any tab on the My Accounts page.
  3. Click anywhere on the text editor and scroll to the bottom of the functions.php file. Paste the code at the end:
add_filter ( 'woocommerce_account_menu_items', 'njengah_remove_my_account_links' );

function njengah_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;

}
  1. Click on the Save changes button at the bottom of the text editor screen.

The code works well, but when you want to remove both the menu item and its page, you do not need any coding. This is because you can find all the default My Account sub pages in WooCommerce > Settings > Advanced. Scroll down to Account Endpoints. All you need is just to set a specific endpoint empty.

Conclusion

In summary, this post shares how to hide any tab on the My Accounts page. Make sure you follow all the steps keenly so that you do not break down your site. Moreover, I have shown you how to delete an account endpoint. If you are not familiar with handling code, I recommend that you hire a qualified WordPress developer.

It is important to note that these code snippets should be added to your child theme functions.php file. You can also use a Site Customization plugin so that you do not lose your changes when you update your WordPress theme.

Similar Articles