I want simply display a field of a product variation type (commerce) two times with different render settings.

I have tried with a dynamic field (display_suite) but it not working... I would prefer to know a programmatically solution to accomplish this task and I want use the (Drupal core) Display Manager for designate my layout (not a template file) :)

Note: This product field do automatically refresh (ajax) like other when a different product variation is selected.

See this related "issue": https://www.drupal.org/node/1494192#comment-7031370

1 Answer 1


You should be able to use template_preprocess_node() to duplicate a field.

I've not run this code and just written it from memory but something like this should suffice:

function template_preprocess_node(&$variables) {

  // Check this is the node type for commerce products
  if($variables['node']['#type'] == 'product') {

    // Copy the existing field to a new item
    $variables['content']['YOUR_FIELD_2'] = $variables['content']['YOUR_FIELD'];

    // Now make any changes to how you want to render the duplicate field


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.