Skip to content
Advertisement

Unset product tabs for specific product categories in woocommerce

I am using the code coming from this answer:

Hiding tabs only for some products in WooCommerce single product pages

Here is that code:

JavaScript

This code works fine to unset or hide tabs from specific products.

Instead I would like to unset or hide tabs from specific product categories.

How can I do it for product categories?

Advertisement

Answer

As the code originally from one of my answers, it’s very simple to make it work for product categories just changing 2 lines and using WordPress conditional function has_term():

JavaScript

Code goes in function.php file of your active child theme (or theme) or also in any plugin file.

The code tested and works in WooCommerce.

WordPress conditional function has_term() accept Ids, slugs or names of your product categories…

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement