Display add to cart form / +product from node template I have a custom node template based on a custom content type and I want to display products with their "Add to Cart" buttons from this custom node template.

In the content type (actually a field collection), I added the Product reference. In the template (node--{content type}.tpl.php) I do this type of thing:

$wrapper = entity_metadata_wrapper('node', $node);
// Since it's a field collection, I loop these:
foreach ($wrapper-&gt;field_content_group as $group) {

  //Now each "$group" has the fields I want to display

  //I permit N products (not just 1), so I can get product information, 
  //like price for example, like this:

  if($group-&gt;field_featured_product) {
    $product_references = $group-&gt;field_featured_product-&gt;value();
    foreach($product_references as $product_reference) {
      $product = commerce_product_load(intval($product_reference-&gt;product_id));
      $price = entity_metadata_wrapper('commerce_product', 
                                       $product)-&gt;commerce_price-&gt;value();
      print $price_display = commerce_currency_format($price['amount'], 
                                                    $price['currency_code'], $product);
    }
  }

}


I don't need to alter the display, I'm happy with that. I'd like to just call something that prints the product, price, etc., along with the "Add to Cart" button. I'm thinking I call commerce_product_load and then some method(s) that gives me the completed form. Is there such a thing that I can call?

NOTE: Yes, I know about separation of concerns and that code is best placed outside of the template file.
Since views seem to be the easiest way to display product offerings, the way I solved this was to create views for the products. The views are configured as blocks. Then I use:

$block = module_invoke('views', 'block_view', $block_name);
print render($block['content']);


to display the block.

I used content type fields to specify the block names I want to display within certain areas so it isn't hard-coded. It isn't terribly elegant, but sometimes programming is that way since there isn't an infinite amount of time to solve problems!