DEV Community

Cover image for How To Remove Download Tab From Woocommerce My Account Page
Mahmudul Hasan Shaon
Mahmudul Hasan Shaon

Posted on

How To Remove Download Tab From Woocommerce My Account Page

Hello there,
Today we will discuss HOW and WHY we need to remove Download Button from WooCommerce MyAccount Page.

Removing Download Button Codes

Imagine you have a WordPress website along with Woocommerce. You are selling physical products like digital goods or clothing there. When customers access their account page, they see a layout that looks like the general layout of the WooCommerce account page.
It's normal, right? But for regular users, this layout must be optimized, right? So, they can understand their panel better.Β 

If you don't have any digital products in your store, that "Download Button" or "Download Section" does not make any sense. In some cases, it can also be confusing too.

Considering that, we need to remove that button.
How can we do that?Β 

Let's say we can do that by using CSS! Easy Peasy

.woocommerce-MyAccount-navigation-link.woocommerce-MyAccount-navigation-link--downloads{

display: none;
}

Enter fullscreen mode Exit fullscreen mode

Yes, you can do that, but that's not right and not the solution we are looking for.Β 

The Solution - Our Solution 😎

Use these codes in your function.php file to remove the downloads tab from the WooCommerce MyAccount page.

Check The GitHub Hack Repo Link


add_filter( 'woocommerce_account_menu_items', 'ShaonPro_remove_downloads_tab_my_account', 999 );

function ShaonPro_remove_downloads_tab_my_account( $items ) {
// You can add other tab names
unset($items['downloads']);
return $items;
}

Enter fullscreen mode Exit fullscreen mode

Here's the regular MyAccount Page with the Download Button before applying any code.

With Download Button

After applying the code, MyAccount Page with no download button.

Without Download Button

We are good to go now πŸ˜‡ - Thanks for your support.

Top comments (0)