# Hide the Downloads Tab When There Are No Downloads

> Removes the Downloads item from the My Account menu for customers who have never bought a downloadable product.

- Type: PHP
- Runs: Run everywhere
- Category: [WooCommerce](https://wpide.com/library/category/woocommerce/)
- Requires: WooCommerce
- Tags: woocommerce, my-account, downloads, navigation
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/woo-hide-empty-downloads-tab/

## Code

```php
add_filter( 'woocommerce_account_menu_items', function ( $items ) {
    if ( isset( $items['downloads'] ) && is_user_logged_in() && ! wc_get_customer_available_downloads( get_current_user_id() ) ) {
        unset( $items['downloads'] );
    }

    return $items;
}, 20 );
```

## Notes

The tab reappears automatically after a customer buys something downloadable.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Hide the Downloads Tab When There Are No Downloads" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
