orry my question was not clear. I have different category and sub-category.Each categories has sub categories ie.


-cream -soap


-cleaner -etc.

I would like to display the widget when this category or their children are selected in the menu.

I have tried this but doesn't work

is_product_category( array( 'care-cosmetic', 'household', 'savoury', 'sweet' ) )

Thanks for helping

1 Answer 1


For the product category page (which is actually a Woocommerce archive type of page) use the condition:

is_product_category( 'shirts' )

For the product page itself use the condition:

has_term( "shirts", "product_cat" )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.