WooCommerce: Hide Category & Tag @ Single Product Page

SKU, Category list and Tag list on the WooCommerce single product page are called “product meta”. We already saw how to hide just the SKU (while leaving Cats and Tags there), so in this “episode” we will study how to do the opposite i.e. keeping the SKU there while hiding Cats and/or Tags.

If you are a developer, you’d think there were a specific WooCommerce “filter” for this, but there is not. So, we have to first remove the whole “product meta” block and then add back the info we want (just the Cats, for example). If you’re not a dev – not to worry – just copy paste one of the snippets below in your functions.php and magic will happen. Enjoy!

We’re looking at the “Product Meta” section on the single product page. Our goal is to hide categories and tags and leave SKU where it is now.

PHP Snippet 1: Hide “SKU” & “Category:__” & “Tag:__” @ WooCommerce Single Product Page

Basically, in here we go and remove the whole “Product Meta” block. And thankfully, it’s just 1 line of code.

If you want to add back just the SKU, just the Cats or just the Tags, use snippet 2, 3 or 4 together with this one.

/**
 * @snippet       Hide SKU, Cats, Tags @ Single Product Page - WooCommerce
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WC 3.8
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */
  
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );

PHP Snippet 2: Show “SKU”Again @ WooCommerce Single Product Page

This is equivalent to saying “Hide Categories and Tags” from product meta. Basically after removing the whole product meta block, we’re readding the SKU.

/**
 * @snippet       Show SKU Again @ Single Product Page - WooCommerce
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WC 3.8
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */

add_action( 'woocommerce_single_product_summary', 'bbloomer_show_sku_again_single_product', 40 );

function bbloomer_show_sku_again_single_product() {
   global $product;
   ?>
   <div class="product_meta">
   <?php if ( wc_product_sku_enabled() && ( $product->get_sku() || $product->is_type( 'variable' ) ) ) : ?>
      <span class="sku_wrapper"><?php esc_html_e( 'SKU:', 'woocommerce' ); ?> <span class="sku"><?php echo ( $sku = $product->get_sku() ) ? $sku : esc_html__( 'N/A', 'woocommerce' ); ?></span></span>
   <?php endif; ?>
   </div>
   <?php
}


PHP Snippet 3: Show “Categories:” Again @ WooCommerce Single Product Page

/**
 * @snippet       Show Categories Again @ Single Product Page - WooCommerce
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WC 3.8
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */

add_action( 'woocommerce_single_product_summary', 'bbloomer_show_cats_again_single_product', 40 );

function bbloomer_show_cats_again_single_product() {
   global $product;
   ?>
   <div class="product_meta">
   <?php echo wc_get_product_category_list( $product->get_id(), ', ', '<span class="posted_in">' . _n( 'Category:', 'Categories:', count( $product->get_category_ids() ), 'woocommerce' ) . ' ', '</span>' ); ?> 
   </div>
   <?php
}


PHP Snippet 4: Show “Tags:” Again @ WooCommerce Single Product Page

/**
 * @snippet       Show Tags Again @ Single Product Page - WooCommerce
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WC 3.8
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */

add_action( 'woocommerce_single_product_summary', 'bbloomer_show_tags_again_single_product', 40 );

function bbloomer_show_tags_again_single_product() {
   global $product;
   ?>
   <div class="product_meta">
   <?php echo wc_get_product_tag_list( $product->get_id(), ', ', '<span class="tagged_as">' . _n( 'Tag:', 'Tags:', count( $product->get_tag_ids() ), 'woocommerce' ) . ' ', '</span>' ); ?> 
   </div>
   <?php
}


Where to add this snippet?

You can place PHP snippets at the bottom of your child theme functions.php file (delete "?>" if you have it there). CSS, on the other hand, goes in your child theme style.css file. Make sure you know what you are doing when editing such files - if you need more guidance, please take a look at my free video tutorial "Where to Place WooCommerce Customization?"

Does this snippet (still) work?

Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting on PHP 7.3.

If you think this code saved you time & money, feel free to join 14,000+ WooCommerce Weekly subscribers for blog post updates or 250+ Business Bloomer supporters for 365 days of WooCommerce benefits. Thank you in advance :)

Need Help with WooCommerce?

Check out these free video tutorials. You can learn how to customize WooCommerce without unnecessary plugins, how to properly configure the WooCommerce plugin settings and even how to master WooCommerce troubleshooting in case of a bug!

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.

30 thoughts on “WooCommerce: Hide Category & Tag @ Single Product Page

  1. Hi,

    Incredibly quick fix, is there a way to hide just 1 specific tag from Single Product Pages?

    1. Hty José, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  2. Thanks it works perfectly

  3. Big thanks. Worked perfectly on Astra free theme Life Coach with WooCommerce and Tutor LMS using Code Snippets (coding is above my brain capacity, so really appreciated this help:)). Stay safe!

  4. doesn’t work anymore ?

    1. Hi Roy, thanks for your comment! I just tested this again with Storefront theme and it works perfectly. Maybe your theme (or another plugin) is messing/conflicting with my snippet.

      To troubleshoot, disable all plugins but WooCommerce and also switch temporarily to “Twentytwenty” theme (load the snippet there in functions.php) as explained here: https://www.businessbloomer.com/lesson/trwm4l01/

      Once you do that, does it work? If yes, you have a problem with your current theme or one of the plugins.

      Hope this helps!

  5. The code is great, but it doesn’t work on the custom product page layout, tried the same line of code, and also tried to work it through by changing the code but no results, it only works on the default woocommerce product layout.

    1. Spot on, all my snippets are for default WooCommerce

      1. I’m using Beaver Themer to create custom single product page layouts (Astra Pro theme). SKU and Categories can be hidden with the following CSS:

        .woocommerce div.product .product_meta > span.sku_wrapper {
        	display: none;
        }
        .woocommerce div.product .product_meta > span.posted_in {
        	display: none;
        }

        If you need to remove Tags you can use:

        .woocommerce div.product .product_meta > span.tagged_as {
        	display: none;
        }
        
  6. Awesome, I love the simplicity of this fix, thanks a lot

    1. Cool!

  7. Perfect quick fix – thanks man!

    1. You’re welcome!

  8. Hi, I loved your tutorials on changing things around Woocommerce. I had a similar question regarding this. I want to remove the category meta data that shows on all products while browsing. So lets say, When you open your products page, your products are displays and for each product below their image, it displays the categories that the product is listed under before the short description. I would like to remove that specific category meta data display from the products. Can you assist on which code to use for that? I looked everywhere but couldnt find any solution to this.

    1. Doesn’t this snippet help?

  9. Hello there, I am having a little problem trying to remove the commas in between the product tags, can anyone point me in the right direction please?

    1. Hi Alal, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  10. Your site is awesome. Thank you for all the tips and tricks as I dip my toe into the world of woocommerce.

    Interestingly enough, I have put all of your (and other) code snippets in ~/wp-includes/functions.php and they’ve all worked, except this one. I had to put this one in where you actually suggest doing it (which i probably should have been doing anyways) in ~/wp-content/themes/customify/functions.php. I can only assume that the ~/wp-includes/functions.php file is not being called for that command? Just wondering if you have any insights on that. Thanks again.

    1. /wp-includes/functions.php is just wrong as you will override that every time you update WordPress. The ideal is your child theme’s functions.php, which is never overwritten

      1. Thanks! (Making Corrections now) 🙂

  11. Great one, as well as all the other tips and snippets that You post.
    Thank You so much!

    1. Thanks!

  12. Awesome… It Works.

    1. Brilliant

  13. Is there an easy way to make the SKU and category display in a single row rather than two rows?

    1. Hi Biff, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      1. It works perfect, Thank for the help.

        1. Cool!

Questions? Feedback? Support? Leave your Comment Now!
_____

If you are writing code, please wrap it between shortcodes: [php]code_here[/php]. Failure to complying with this (as well as going off topic, not writing in English, etc.) will result in comment deletion. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining BloomerArmada to get blog comment reply priority, ask me 1-to-1 WooCommerce questions and enjoy many more perks. Thank you :)

Your email address will not be published.