I'm playing around with woocommerce and I followed their instructions to do my own single-product template by copying to my theme's folder within the structure they recommend.

So the thing is that the product page is working pretty well, but I'm facing some issues when is a variable product involved.

My question is, are there any hook or something to display the variations associated with that specific product, something like when you add product's attributes manually like:

<?php echo apply_filters('single_add_to_cart_text', __( 'ADD TO MY BASKET', 'woocommerce' ), $product->product_type); ?>

That will add the single add to cart button individually, is there a similar code to display the product variations? Thanks a lot.


No afraid not, there really isn't a hook/filter that displays the variations.

If you've copied all the template files to your themes directory you need to look at ..THEME..\woocommerce\single-product\add-to-cart\variable.php to see how WooCommerce displays the product variations.

| improve this answer | |
  • Thanks for your answer Stephen, I will try this. In fact I copied the code within variable.php within my template but I got error. The thing is that I'm not using the woocommerce's default <?php woocommerce_get_template_part( 'content', 'single-product' ); ?> because that inserts the entire thing as a block and I hate to not have control of individual data. I will try to use INCLUDE for variations.php – Jaypee Jan 21 '13 at 15:44
  • Sounds like you're making a lot of extra work for yourself. Look at using the 'standard' WooCommerce/WordPress flow and modifying the content parts in the single-product directory. – Steve Jan 21 '13 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.