I have created a custom node.tpl.php file for the product_display content type. I have everything worked out except I have no ideal how to isolate the "add to cart" button, actually the "add to cart" form, and render it within the template wherever I need it.

3 Answers 3


The product reference itself renders as the button. In your product display content type, make sure the product reference has the "Add to Cart form" format, then render it thus:

<?php print render($content['field_product']); ?>
  • I have seen this solution many many times, but mine just wont show anything, not even an error message and the format is set to "add to cart".
    – J-Fiz
    Dec 16, 2011 at 20:51
  • 2
    I got I!... I was trying to do all this in teaser mode so I had to modify the teaser display, thanks.
    – J-Fiz
    Dec 16, 2011 at 21:17

For future reference, you can add the "Add to Cart" button to your D7 taxonomy or front page view by visiting Structure -> Content Types -> [Product Type] / Manage Display -> Teaser.


To add the "Add to cart" button, go to the manage display of the product reference field and set "Add to Cart form" in Format column.

  • I would expect this as default behaviour. Thanks for sharing.
    – Augusto
    Jan 3, 2016 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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