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

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

If your online store doesn’t sell any digital products or downloadable, then there is no need to have the ‘Downloads’ menu on the My Account page. The presence of such options may not align with the store’s business model, and keeping these default options can confuse customers when they visit their account page. You can easily remove this either through WooCommerce settings or by using a simple code.

This post helps you to remove downloads menu from the ‘My Account’ page in WooCommerce. 

Remove the Downloads Menu via WooCommerce settings

The default WooCommerce comes with a lot more endpoints and one such option is the My Account endpoint. If you want to remove any of these URL slugs from this page, you simply need to keep the field blank to disable the endpoint as shown below.

  • Visit WooCommerce > Settings > Advanced.
  • In the Account endpoints section, find the entry for Downloads.
  • Remove the entry by leaving it blank.
  • The downloads menu will no longer be visible on the My Account Page.
How to Remove Downloads from My Account Page Menu in WooCommerce? - Tyche Softwares

Now, let’s see how to remove the downloads menu via code.

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: Remove Downloads from WooCommerce My Account Page Menu via code

If an online store exclusively sells physical products, then keeping the ‘Downloads’ option is of no use. In such cases,  you would like to present only the options that align with your store. So, the below code snippet will help to remove such unnecessary options from the My Account page.

function ts_custom_my_account_menu_items( $items ) {
    unset($items['downloads']);
    return $items;
}
add_filter( 'woocommerce_account_menu_items', 'ts_custom_my_account_menu_items' );

Output

The output shows that the downloads menu has been removed from the ‘My Account’ Page. 

How to Remove Downloads from My Account Page Menu in WooCommerce? - Tyche Softwares

Code Explanation

  1. The code defines a function named ts_custom_my_account_menu_items that takes an array of menu items as a parameter.
  2. Inside the function, it uses the unset function to remove the ‘downloads’ item from the array of menu items.
  3. The add_filter function is then used to hook the ts_custom_my_account_menu_items function into the woocommerce_account_menu_items filter.
  4. When this filter is applied, it modifies the array of menu items by removing the ‘downloads’ item from it.
  5. As a result, the ‘Downloads’ menu item will be removed from the My Account menu in WooCommerce.
Recommended Reading: How to Change the Titles of My Account Page in WooCommerce?

Conclusion

The above code snippets help you to remove a particular menu from the My Account Page. Similarly, you can also remove a specific field from a  particular menu such as removing the last name field from my account page in woocommerce.

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

Share It:

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