• I’m trying to add a button to my single product pages which allows the user to request a sample, however I only need this to be seen on products within certain categories.

    I’ve got the button appearing on the single product page, however I want to now single out the categories on which it should only appear.

    This is what I’ve got so far, but it doesn’t seem to be working…

    <?php if is_product_category( array( 'coving', 'skirting-boards', 'dado-rails', 'indirect-lighting-by-orac' ) ){ ?>
        <div id="requestsample"><a class="fancybox button" href="#contact_form_pop">Request a Sample</a><div class="fancybox-hidden" style="display: none;"><div class="hentry" id="contact_form_pop" style="width: 600px; height: 500px; overflow-x: hidden"><?php echo do_shortcode( '[contact-form-7 id="269" title="Request Sample"]' ); ?></div></div></div>
      <?php} ?>

    Can anyone help me out… Am I on the right track?
    Any help will be greatly appreciated!!
    Thanks in advance!

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

Viewing 1 replies (of 1 total)
  • You would need to change the code to the following:
    <?php if (is_product_category(arrry(‘cat1′,’cat2′,’cat3’)){ ?>
    <div></div>
    <?php } ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Conditional Tags is_product_category’ is closed to new replies.