Forums

WooCommerce - excelling eCommerce
[resolved] is_product_category vs. in_product_category (3 posts)

  1. sime0n
    Member
    Posted 8 months ago #

    Hey,

    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

    http://wordpress.org/extend/plugins/woocommerce/

  2. mikejolley
    Member
    Plugin Author

    Posted 8 months ago #

    You can just use:

    http://codex.wordpress.org/Function_Reference/has_term

    The taxonomy is product_cat

  3. sime0n
    Member
    Posted 8 months ago #

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

Reply

You must log in to post.

About this Plugin

About this Topic