62

I would like to remove downloads menu from my account page.

How can I do this? Is it any hook to remove a specific item from the menu?

Thanks.

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
techiva.blogspot.com
  • 1,170
  • 3
  • 17
  • 37

3 Answers3

173

Go to WooCommerce > Settings > Advanced and remove the entry for Downloads in the Account endpoints section, just leave it blank. And the menu will not be visible anymore.

remove downloads link

AndreVitorio
  • 622
  • 1
  • 7
  • 18
Christophvh
  • 12,586
  • 7
  • 48
  • 70
  • Hi @Christophvh, this is seems doesn't work for order. Any advise? – Ivan Slaughter May 21 '17 at 09:36
  • 1
    This is not correct or recommended method. Istead I will suggest to prefer below code written by @LoicTheAztec – Makarand Mane May 22 '18 at 19:57
  • 2
    @MakarandMane Why is it not "correct or recommended"? The instructions within Woocommerce state that a field can be left blank for it to be removed. Is it not preferable to keep standard behaviour instead of overriding it with code? – wickywills Feb 27 '19 at 09:32
  • Account endpoints. Endpoints are appended to your page URLs to handle specific actions on the accounts pages. They should be unique and can be left blank to disable the endpoint. – AJD Jul 13 '19 at 19:30
63

You will need this lightly customized this code snippet:

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

This code goes on function.php file of your active child theme (or theme) or in any plugin file.

This code is tested and working

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
  • 2
    This should be the accepted answer, as it better fits WC logic – Max May 30 '18 at 11:14
  • A great solution if one don't want users to add back the endpoint, but still the accepted answer gives more power to site admins. – Gabriel Reguly Jun 04 '20 at 22:48
  • 1
    @GabrielReguly As StackOverFlow is coding oriented, so I have answered a with coding oriented answer. – LoicTheAztec Jun 05 '20 at 00:21
  • 2
    Thank you @LoicTheAztec for answering me :-) I agree that yours is a great solution and yes, StackOverflow is very code oriented, so your answer fits very well in the spirit of the site and I thank you for sharing it. Still for users who don't want to mess with the code, the other solution fits them better. Seems that for this issue there is not an one-size-fits-all solution ;-) – Gabriel Reguly Jun 05 '20 at 20:51
0
[data-tab="downloads"] {
    display: none!important;
}
Sean
  • 114
  • 1
  • 13