WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Conditional Tags is_product_category (2 posts)

  1. krisscross90
    Member
    Posted 8 months ago #

    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/

  2. ouverz
    Member
    Posted 8 months ago #

    You would need to change the code to the following:
    <?php if (is_product_category(arrry('cat1','cat2','cat3')){ ?>
    <div></div>
    <?php } ?>

Reply

You must log in to post.

About this Plugin

About this Topic