WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. sime0n
    Member
    Posted 1 year 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 1 year ago #

    You can just use:

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

    The taxonomy is product_cat

  3. sime0n
    Member
    Posted 1 year ago #

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

  4. jquerytou
    Member
    Posted 1 year ago #

    Hello,
    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,

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic