[resolved] is_product_category vs. in_product_category (4 posts)

  1. sime0n
    Posted 3 years ago #


    I'm extending a theme to use a different Nivo slider for each category / subcategory. is_product_category works well for the top level category but products inside that category are being missed since technically they aren't the category itself (in vs. is).

    Is there a WooCommerce function for specifying products in a category, something like:

    if ( in_product_category( '#' ) ) {
    echo do_something();

    I checked out the conditionals page and searched through the WooCommerce docs but didn't find anything.

    Is there currently a way to display elements in certain product categories and not others? TIA


  2. Mike Jolley
    Plugin Author

    Posted 3 years ago #

    You can just use:


    The taxonomy is product_cat

  3. sime0n
    Posted 3 years ago #

    Tried has_term before posting here, didn't work, was missing taxonomy. Added the taxonomy, works. Thanks!

  4. jquerytou
    Posted 3 years ago #

    I am trying to implement it just for single product views, working either in functions as in templates, but without any success.
    Is there a way to display the product category image just when viewing single products associated with one category?
    At the moment I'm developing locally with a twentytwelve child theme, so there is not a live link I can give.

    Thanks in advance for any help,


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic