I am using the Woocommerce plugin. I am trying to create a different container for when I am displaying multiple products then when I display multiple categories.

So far in my archive_products I have a check for is_shop() and if it is then it means that I am displaying categories and not products. So I load my category style containers.

The problem is that if the category has sub categories and you click to see those sub categories, you are now failing the is_shop() function.

How can I still know if I am up to displaying available products or if I am displaying subcategores?

1 Answer 1


I think the conditional you're looking for is:

is_product_category() Returns true when viewing a product category archive.

You can see the docs at Conditional Tags

A bit of Google searching seems to indicate that this isn't always reliable, depending upon your scenario. See here on WordPress codex.

  • is_product_category() is for displaying products of a particular category. I am looking for displaying more sub-categories.
    – Lucky Luke
    Jan 24, 2013 at 21:19
  • A subcategory is still a category, so I would think is_product_category() would still apply. Jan 24, 2013 at 21:22
  • @helgatheviking but since i dont display products when displaying sub categories I want to know if this a product page.
    – Lucky Luke
    Jan 25, 2013 at 11:24
  • @LuckyLuke then the conditional would be is_product(), about five lines down in the documentation link I placed in the answer.
    – Steve
    Jan 25, 2013 at 13:20
  • @Stephen that would only return true when on a single product page, not when displaying multiple products
    – Lucky Luke
    Jan 26, 2013 at 17:48

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