WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Conditional Tags on Single Product Pages (3 posts)

  1. mharmontx
    Member
    Posted 9 months ago #

    This code from Woocommerce's website lets you target categories on your website to display messages. The only problem with this is that it does not work on Single Product pages.

    I'd like my single product pages to be able to display notes depending on their parent category.

    Any ideas?

    <?php
    if ( is_product_category() ) {
    if ( is_product_category( 'batteries' ) ) {
    echo 'Testing';
    } elseif ( is_product_category( 'games' ) ) {
    echo 'Testing';
    } else {
    echo 'Testing';
    }
    }
    ?>

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

  2. mharmontx
    Member
    Posted 9 months ago #

    I'm trying to do something this >

    <?php if ( is_product_category('batteries') && is_single){ echo "This is a single post"; } ?>

    but it isn't working correctly.

  3. serons
    Member
    Posted 4 months ago #

    Could you use is_product()? WooCommerce Conditional Tags

Reply

You must log in to post.

About this Plugin

About this Topic