Hello there,
Today we will discuss HOW and WHY we need to remove Download Button from WooCommerce MyAccount Page.
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;
}
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;
}
Here's the regular MyAccount Page with the Download Button before applying any code.
After applying the code, MyAccount Page with no download button.
We are good to go now 😇 - Thanks for your support.
Top comments (0)