you’re not saying what you’re trying to do
Hi Svetoslav!
I am trying to achieve the below scenario in Widget Logic:
If product category of display type ‘subcategory’: hide price filter widget
If product category of display type ‘products’: show price filter widget
How to write the logic using conditional tag is_product_category()
Thank You!
Hi @younes89,
With WooCommerce conditional tags, there is one for testing if the current page is a category archive or not:
https://docs.woocommerce.com/document/conditional-tags/#section-5
is_product_category()
It can test for a product category in general or a specific product category or categories. It does not have an option to test for sub-categories in general, but you could test for a specific sub-category just like you would a specific parent category.
is_product_category( 'product' )
That returns true when viewing the product category called “product”. To get everything that isn’t that, you would use:
! is_product_category( 'product' )
With that conditional, it will return true everywhere but the product category called “product”.