Hide WooCommerce Categories from Product Pages and Shop Pages

WooCommerce adds categories to product pages by default, in the format of Home/Category Name/Product Name. There is no built-in feature that supports removing the category from product pages. The same thing goes for shop pages. You must edit your WordPress functions.php file or install a plugin to deal with it.

In this article, we will guide you on how to hide WooCommerce product categories from both single product pages and shop pages.

What Are WooCommerce Categories and Their Benefits?

Instead of showing a long list of all products belonging to different product types, you can organize them based on features using WooCommerce categories. Buyers are able to find what they want within seconds.

You sell clothing, for instance, you might have categories namely “Shirts”, “Hoodies” and “Caps”. What’s more, when displaying the categories on product pages, you have a chance of engaging consumers to upsell or cross-sell. They can click on the links to the categories and refer to other products.

Showing product categories on product pages and shop pages brings various benefits. However, there may be times when you don’t want visitors to access your categories. It can be a private category whose products should be invisible from the public store.

Hide WooCommerce Categories from Single Product Pages

It’s possible to use a PHP function to hide categories from product pages. However, it’s not ideal to directly edit the theme functions.php file. You ought to create a child theme otherwise new code in the functions.php file will be gone with the next theme update. In case you don’t want to create a child theme, use the Code Snippets plugin and add the code there.

Edit your functions.php file

Follow these 3 steps to manually hide WooCommerce categories from single product pages in cPanel:

  1. Head to your WordPress theme file and click Code Edit under functions.php in your theme folder
    Here is the usual path to go there:

  2. Place this code at the bottom of the file
    /* Remove Categories from Single Products */
    remove_action( 'woocommerce_single_product_summary',
    'woocommerce_template_single_meta', 40 );
  3. Save the file

After editing the theme functions.php file, your category no longer shows up on any product pages.

Customize WordPress CSS

Another solution to remove WooCommerce categories comes to adding custom CSS code. You can customize your WordPress CSS by:

  1. Going to AppearanceCustomize in your admin dashboard
  2. Choosing Additional CSS option
  3. Entering this custom CSS code in the box on the left side
    .product_meta .posted_in {display: none;}


  4. Adding !important to the code in case it doesn’t work
    .product_meta .posted_in {display: none !important;}

Password Protect WooCommerce Categories

What if you want to protect WooCommerce categories from unauthorized users? Hiding the category from product pages is not enough to secure your private categories. Even though visitors aren’t able to see the hidden categories’ names, they can search for the category URLs on Google and view all of your products.

It’s time to turn into Password Protect WordPress Pro plugin and its Access Level extension! The plugin primarily comes as a WordPress page, post, and category password protection solution. You can also secure other types of post types, and WooCommerce products in particular.

Once a WooCommerce category is locked with a password, all its products become protected too. You’re able to apply access levels for different product categories as well. If users unlock the higher level category, they can view and purchase products in lower categories without having to enter passwords.

To use PPWP Pro and Access Levels to password protect product categories, you need to:

  1. Download and install PPWP Pro plugin
  2. Download Password Access Levels extension. Upon activation, the plugin and its extension will be added directly to your WordPress admin navigation menu.
  3. Click Add New Base and provide the base name as well as a description (optional)
  4. Edit levels
  5. Choose Products from the Post Type dropdown
  6. Select all categories you want to password protect
  7. Decide levels for these categories. From the example, Cat B has a higher level than Cat A. Categories not belonging to any level will be assigned level 0, the lowest level by default.
  8. Head to Add New Password tab
  9. Enter your password and other information such as password level and password type
    Higher-level passwords can unlock all products at the same or lower-level categories. Global passwords permit all types of users to access the private category. When setting roles for passwords, only specific logged-in users can view protected products.

Hide Categories from Shop Pages

If you offer customer-specific products, you should hide your private category from the shop page. For example, you sell uniforms to different schools. Each school can access a category to see its own uniforms. They shouldn’t view other schools’ uniform categories.

Be sure to copy this code and enter it to your functions.php to hide WooCommerce categories from the shop page:

* Show products only of the selected category.
function get_subcategory_terms( $terms, $taxonomies, $args ) {
$new_terms = array();
$hide_category = array( 126 ); // Ids of the category you don't want to display on the shop page
// if a product category and on the shop page
if ( in_array( 'product_cat', $taxonomies ) && !is_admin() && is_shop() )
foreach ( $terms as $key => $term ) {
if ( ! in_array( $term->term_id, $hide_category ) ) {
$new_terms[] = $term;
$terms = $new_terms;
return $terms;
add_filter( 'get_terms', 'get_subcategory_terms', 10, 3 );

It’s not necessary to display the Uncategorized category either. You can apply several solutions to remove this category and improve your site quality as well as increasing buyer satisfaction.

Make Use of Hidden WooCommerce Categories

WooCommerce categories assist you in sorting out your products. Visitors don’t have to scroll up and down to find products in a long list of items anymore. Instead, they can go to the right category and make purchases.

It’s not simple to hide WooCommerce product categories from individual product pages or the shop page unless you get the right methods. You can manually add code to the functions.php file or enter custom code into WordPress CSS to achieve that. Remember to create a child theme and make changes to its PHP file. This helps prevent losing settings once your theme is updated.

Want to increase WooCommerce category security? Make use of the Password Protect WordPress Pro plugin and its Access Levels extension. Not only all products in categories are protected with passwords, but you can also assign access levels to these categories.

Looking for solutions to removing related products from product pages? Refer to our useful article How to Remove Related Products in WooCommerce.