In WooCommerce, the “Downloads” tab on the My Account page is always visible to users, even if they haven’t purchased any downloadable products. This default setup can make the page feel cluttered or irrelevant, particularly for customers who don’t have any downloads available.
In this guide, I’ll show you how to improve the user experience by hiding the “Downloads” tab for users without downloadable products linked to their account. With a simple code snippet, you can make your WooCommerce store more intuitive, displaying the Downloads section only for those customers who actually need it.
This tutorial is designed to help you enhance the My Account page, whether you’re just starting with WooCommerce or aiming to optimize the page layout for a cleaner, more customer-friendly interface. Let’s get started!
add_filter( 'woocommerce_account_menu_items', 'wwccs_hide_downloads_tab_my_account', 9999 );
function wwccs_hide_downloads_tab_my_account( $items ) {
$downloads = ! empty( WC()->customer ) ? WC()->customer->get_downloadable_products() : false;
$has_downloads = (bool) $downloads;
if ( ! $has_downloads ) unset( $items['downloads'] );
return $items;
}