I'm trying to render a product reference field using field_view_value() - which works except for the attribute options don't render. If it's rendered normally on a node, or in views then the attributes display as normal. Any ideas how to fix this?

$product_obj = node_load($nid);
$product_field = field_get_items('node', $product_obj, 'field_product');
$cart = field_view_value('node', $product_obj, 'field_product', $product_field[0]);

print render($cart);

1 Answer 1


Instead of using field_get_items/field_view_value try field_view_field.

$product_display = node_load($nid);
$add_to_cart = field_view_field('node', $product_display, 'field_product');
$add_to_cart['#label_display'] = 'hidden';
$cart = drupal_render($add_to_cart);

Your Answer

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

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