DEV Community

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

Posted on

4 1

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.

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay