Support » Plugin: WooCommerce » Woocommerce Conditional Tags

  • Resolved younes89



    I am trying to use Woocommerce conditional tags to write a logic to only display widgets in products categories with display type ‘Products’

    I am using Widget Logic Plugin for this purpose, and tried the below tag:

    is_product_category() with variable/value $display_type : ‘products’

    I need help on how to write the logic for this purpose.

    Thank You!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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!

    Plugin Support Three Sons


    Hi @younes89,

    With WooCommerce conditional tags, there is one for testing if the current page is a category archive or not:


    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”.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Woocommerce Conditional Tags’ is closed to new replies.