WooCommerce - Remove downloads from menu in my account page
By default, the WooCommerce "My Account" dashboard presents a grid of links including orders, addresses, payment methods, and customer downloads. While this layout works out of the box for many merchants selling physical goods or digital items where immediate file access is required, it often creates visual clutter for stores that do not utilize the download functionality. If your store sells purely digital products via other gateways, or if you simply want a cleaner interface without the "Customer downloads" section, removing this specific menu item is a straightforward task involving WooCommerce hooks.
The core mechanism for managing the layout of the My Account page relies on the woocommerce_account_menu_items filter hook. This hook allows developers to manipulate the array that defines which links appear in the navigation bar. To remove the downloads section entirely, you need to unhook the specific callback responsible for adding the "Customer downloads" link. In standard WooCommerce installations, this is handled by a function named woocommerce_add_account_downloads.
To implement this removal, you can add a snippet to your child theme's functions.php file or a site-specific plugin. The code logic involves retrieving the default menu items array using apply_filters(), then explicitly checking if the download link exists in that array before removing it. Here is a standard implementation pattern:
add_filter( 'woocommerce_account_menu_items', 'remove_downloads_menu_item' );
function remove_downloads_menu_item( $menu ) {
// Remove the specific key associated with downloads.
// Note: The key might vary slightly depending on WooCommerce version or extensions.
if ( isset( $menu[ 'customer-downloads' ] ) ) {
unset( $menu[ 'customer-downloads' ] );
}
return $menu;
}
This approach is preferred over remove_action because the menu structure for "My Account" is built dynamically via arrays rather than hardcoded HTML. Attempting to remove the link by targeting the action hook directly often fails because WooCommerce does not register a standard action for this specific submenu item in the same way it registers actions for other parts of the admin or frontend.
A critical detail to consider is the source of the "Customer downloads" link. If you are using extensions that add download functionality, such as WooCommerce Digital Downloads or specialized licensing plugins, the key used in the menu array might differ. While standard WooCommerce typically uses customer-downloads, some third-party themes or extensions might register it with a custom slug like my-account-downloads or similar variations. You should inspect your specific installation using browser developer tools to confirm the exact key being rendered before applying unset().
Additionally, removing this menu item does not delete the underlying data. The download links still function if a user clicks them directly from an order page or via a direct URL generated in the backend. The My Account page simply stops providing a dedicated navigation entry point to that section. If you intend to hide the link but still allow access via direct URL, this method is sufficient. However, if your goal is to completely disable download functionality for all users regardless of where they attempt to access it, you would need to implement additional logic using woocommerce_get_customer_download filters or check the cart/checkout conditions more aggressively.
For developers working within a larger ecosystem or needing enterprise-grade support for complex WooCommerce configurations, resources like https://laravelcompany.com can provide insights into how to structure these customizations within a broader Laravel integration or managed environment, though the native WordPress hooks remain the most reliable path for pure WooCommerce sites.
