Ready to get started?Download WordPress


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

  1. mharmontx
    Posted 1 year 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?

    if ( is_product_category() ) {
    if ( is_product_category( 'batteries' ) ) {
    echo 'Testing';
    } elseif ( is_product_category( 'games' ) ) {
    echo 'Testing';
    } else {
    echo 'Testing';


  2. mharmontx
    Posted 1 year 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
    Posted 11 months ago #

    Could you use is_product()? WooCommerce Conditional Tags

  4. BowsDesign
    Posted 5 months ago #

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic