Support » Plugin: WP eCommerce » Single product page conditional

  • Resolved nicknack


    Trying to add a condition in the single-product template but can’t get it to work.

    <?php if(is_tax( 'wpsc_product_category', 'category-slug') & is_singular( ‘wpsc-product’ )) : ?>
    <?php else: ?>
    <p>Something else</p>
    <?php endif; ?>

    Very grateful for any ideas

Viewing 6 replies - 1 through 6 (of 6 total)
  • <?php if(is_tax( ‘wpsc_product_category’, ‘category-slug’) & is_singular( ‘wpsc-product’ )) : ?>

    Hi Nick,

    is that a typo or what you’ve actually got? It’s double && for logical AND.


    $msg = print_r(is_tax( ‘wpsc_product_category’, ‘category-slug’), true);
    $msg .= print_r(is_singular( ‘wpsc-product’ ), true);

    mail(‘you’, ‘debug’, $msg);

    Hi Dom
    Yes no typo, added the double && but still not working
    looks like this now
    <?php if(is_tax( 'wpsc_product_category', 'category-slug') && is_singular( ‘wpsc-product’ )) : ?>

    And the debug mail output?

    Plugin Author Mihai


    not sure if it counts but your wpsc-product quotes look weird here:
    they look like apostrophes.

    Instead of ‘ they look like ` from what you pasted.

    Hi Misulicus
    Yes they were apostrophes, although hasn’t made any difference unfortunately

    This works, (cheers Dom)

    <?php if(has_term('category-slug', 'wpsc_product_category' ) && is_singular( 'wpsc-product' )) : ?>
    <?php else: ?>
    <p>Something else</p>
    <?php endif; ?>

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Single product page conditional’ is closed to new replies.