I'm using kickstart 2. I have product variation types and a content type for each product. field_desc under the content type manage fields, I have managed to hide and print render successfully in my node--product--type.tpl.php.

However, I have another field called field_spec which is a variation type field rather than a content type field. when I use the following codes in my tpl.php to hide and print the field_spec, this field is not hidden or printed where I want.

I use the following codes to hide and print both field_spec and field_desc however field_spec isn't hiding whereas field_desc is:


 print render($content['field_desc']);

I have checked that field_spec is spelled correctly, I have cleared caches etc. however I cannot hide and print field_spec.

Is this something to do with the fact field_desc is a content type field whereas field_spec is a variation type field?

Thank you

  • what is actually in $content['field_spec']? it should be a render array if hide() is going to work its magic and put a ['#printed'] = TRUE in there.
    – Jimajamma
    Commented Dec 4, 2013 at 17:29
  • Are you sure that the variable $content['field_spec'] is defined in your node--product--type.tpl.php file? Since you mentioned that it is not a content field, there is a good chance that it is not defined there.
    – Elin Y.
    Commented Dec 5, 2013 at 6:45

1 Answer 1


I think you need to use $content['product:field_NAME'] for this

See this answer for more info: Print out a Drupal Commerce field only if it has a value

  • Great thank you, <?php print render($content['product:field_NAME']); ?> works perfectly Commented Dec 6, 2013 at 9:33

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.