By default, WooCommerce adds categories to product pages in the format home/category name/product name – there is no easy way to remove the category from product pages. The same applies to store pages. To change this, you will need to edit your WordPress functions.php file or install a plugin.
In this article, we’ll show you how to hide WooCommerce product categories from both individual product pages and store pages.
What are WooCommerce categories and their advantages?
WooCommerce categories allow you to organize your products by characteristics. Shoppers can find what they are looking for within seconds.
For example, if you sell clothing, you could set up the categories “Shirts”, “Hoodies” and “Caps”. By displaying the categories on the product pages, you also have the opportunity to encourage customers to upsell or cross-sell. They can click on the links to the categories and refer to other products.
Displaying product categories on product pages and store pages has various advantages. However, you may not want visitors to access your categories. In this case, you should set up a private category with products that are invisible to the public store.
Hide WooCommerce categories on individual product pages
You can use a PHP function to hide categories from product pages. However, it is not recommended to edit the theme’s functions.php file directly.
Best practice is to create a child theme, otherwise the new code in the functions.php file will disappear again with the next theme update. If you do not want to create a child theme, use the Code Snippets plugin and insert the code we recommend below.
Edit your functions.php file
Follow these 3 steps to manually hide WooCommerce categories from individual product pages in the cPanel:
Go to your WordPress theme file and click Code Edit under functions.php in your theme folder.
Here is the usual path:
public_html/wp-content/themes/YourThemeName-child/functions.ph
Insert this code at the end of the file – when adding code to your functions.php file, always place new functions at the end of the file but before the closing PHP tag (if one exists) to avoid breaking existing functionality.
<?php
/**
* Remove categories from individual products
*/
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
?>
Save the file. After editing the functions.php file of the theme, your category will no longer be displayed on the product pages.
Customize WordPress CSS
Another way to remove WooCommerce categories is to add custom CSS code. You can customize your WordPress CSS as follows:
Go to Appearance → Customize in your admin dashboard.

Select the Additional CSS option.

Enter this custom CSS code in the field on the left-hand side:
.product_meta .posted_in {display: none;}
You can add !important to the code if it does not work:
.product_meta .posted_in {display: none !important;}
Password protection for WooCommerce categories
If you simply want to protect WooCommerce categories from unauthorized users, hiding the category on the product pages is not enough to protect your private categories. Even if visitors cannot see the names of the hidden categories, they can search for the URLs of the categories on Google and see all your products.
In this scenario, the Password Protect WordPress Pro plugin and its Access Level extension can help. The plugin works as a solution for password protecting WordPress page, posts and categories. You can also protect other types of post types and WooCommerce products in particular.
Once a WooCommerce category is locked with a password, all its products are also protected – plus, you can also set up access levels for different product categories. When users unlock the parent category, they can view and purchase the products in the lower categories without having to enter passwords.
To use PPWP Pro and access levels for password protection of product categories, you must:
Download and install PPWP Pro plugin. Then, download the PPWP Access Levels extension. Once activated, the plugin and its extension will be added directly to your WordPress admin navigation menu.
Click on Add new base and enter the name of the base and a description (optional).

Next, select Edit levels.

Select products from the Post Type drop-down list. Here, you can select all categories that you would like to protect with a password.

Set the levels for these categories. In the example, category B has a higher level than category A. Categories that do not belong to any level are assigned level 0 by default, the lowest level.
Switch to the Add new password tab. Enter your password and other information, such as password level and password type.

Higher-level passwords can unlock all products in the same or lower-level categories. Global passwords allow all users to access the private category. If you define roles for passwords, only certain logged-in users can view protected products.
Hide categories on store pages
If you offer customized products, you should hide your private category on the store page. For example, you sell uniforms to different schools. Each school can access a category to see their own uniforms. The uniform categories of other schools should not be displayed.
Copy and paste this code into your functions.php to hide WooCommerce categories on the store page:
<?php
/**
* Show only products of the selected category.
*/
function get_subcategory_terms($terms, $taxonomies, $args) {
$new_terms = array();
$hide_category = array(126); // Ids of the category that should not be displayed on the store page
// If a product category and on the store 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);
?>
The “Uncategorized” category does not have to be displayed either, as there are several solutions to remove this category and improve the quality of your website and make the user experience better.
Conclusion
Organizing your WooCommerce categories can ensure your visitors don’t have to scroll up and down to find products in a long list of items. Instead, they can go to the right category for their search intent.
To hide WooCommerce product categories, you can manually add code to the functions.php file or add custom code to the WordPress CSS to achieve this. Remember to create a child theme if you want to make PHP changes, as otherwise your settings will be lost when your theme is updated.
And if you want to increase the security of WooCommerce categories, you can use the Password Protect WordPress Pro plugin and its Access Levels extension. This not only protects all products in categories with passwords, but also allows you to assign access levels to these categories.