Check If Current Page is a Product Category

Are you using is_category() and nothing works?… This tut is just for you! 🎉

Please keep in mind, that product categories in WooCommerce are just a WordPress taxonomy product_cat. It means that it is possible to use all the conditional tags related to taxonomies as well.

But let’s begin with WooCommerce conditional tags first.


if( is_product_category() ) {
	// yay, we are on a product category page!
} else {


It is also possible to pass multiple values in an array:

if( is_product_category( array( 5, 10, 891 ) ) ) {
	// do something for product categories with ID = 5 or 10 or 891
} elseif( is_product_category( 'snowboards' ) ) {
	// do something only for product categories with slug or title "snowboards"
} else {
	// do something else for other pages

Do you remember I mentioned before that product categories are taxonomies? So, here is the list of WordPress native conditional tags we can use as well:

This is the example, similar to above:

if( is_tax( 'product_cat', array( 5, 10, 891 ) ) ) {
} elseif( is_tax( 'product_cat', 'snowboards' ) ) {
} else {

The reasonable question is – “What is the difference?”

There is no differences, the function is_product_category() is just a wrapper for is_tax( 'product_cat' ).

Well, maybe the only thing you should keep in mind is if you decide to deactivate WooCommerce plugin without changing a theme, all your is_product_category() functions will return error 500 unless you add an additional condition function_exists( 'is_product_category' ).

WooCommerce Conditional Tags

Misha Rudrastyh

Misha Rudrastyh

I develop websites since 2008, so it is total of 13 years of experience, oh my gosh. Most of all I love love love to create websites with WordPress and Gutenberg, some ideas and thoughts I share throughout my blog.

Need some developer help? Contact me