How to remove the category from product page in WooCommerce

Today we are going to learn how to remove a category from the product page. This is a simple tutorial that will walk you through creating a code snippet and adding it to your website.

The product category in WooCommerce by default is displayed at the bottom of the product page after the add to cart button. Product categories links can be useful in some cases. Especially in situations where a good product categorization and structure is an important way of organizing the products in the store. But some shops run things a bit differently and might not need having the product category shown at this exact place. This might be due to the way your store is organized or simply a design choice.

To hide the product category from showing on your WooCommerce product page you have a few choices. The most obvious one is if your WooCommerce theme provides a dedicated option to show/hide the WooCommerce category. If your WordPress theme does not have such an option, we are left with few other options. We can use custom PHP code or use CSS code.

Let’s look into all the different options.

woocommerce remove product category

Remove category from product page with a code snippet

Luckily, WooCommerce provides us with the woocommerce_single_product_summary  action hook that we can use to add, filter, and remove the desired information from the shop page. Adding this filter will remove the categories from the single product page. Here is the actual code snippet:

As always you can add the code into your WordPress child theme functions.php file. Alternatively, you can add it via the dedicated code snippets plugin. Whichever method works for you, just make sure that the code won’t be deleted the next time you update your theme or plugins.

You can see all of the WooCommerce hooks for the product summary box in the plugin /woocommerce/includes/wc-template-hooks.php under the “Product Summary Box” section:

As you can see there are quite a few filters you can use to modify the single product page in your WooCommerce store. You can for example remove the product title, remove the product ratings, etc.

Using CSS code

If you decide to go the custom code route, the PHP method described above is the recommended way. But if you want a simpler and less bug-prone solution, you can achieve the same results with simple CSS code. All you have to do is to add the following CSS code snippet into your “Additional CSS” field in Theme Customiser:

Some WordPress themes might have a different place to put custom CSS code, so make sure you check the theme’s documentarian for details.

Conclusion

Categories are an important feature in any ecommerce website, but since WooCommerce allows you to display so many attributes on the single product pages, sometimes the number of attributes can get overwhelming, and we may want to hide some of them. In this tutorial explored a few ways of removing the category from a WooCommerce product page. We hope you find this tutorial useful.