I want to alter product variation view and want to display a new form which value depends on variation price. I can add the field to the node using hook_node_view_alter() but i want to add it to the product variation right after the price field. I just need to display an integer dependent of the price.

Any help with this?

Thank you


1 Answer 1


You can try hook_entity_view_alter() API function provided by Drupal Core to alter any entity.

If you want to alter how the entity will look, you can also try using Display Suite or Panels module which are used to override the display.

  • I have tried that but can not add field in the product variation only on the node. I want my field to be right next to price and i can not do that with entity_view_alter
    – Ylli
    Feb 12, 2016 at 13:54
  • In this case you can go with Display Suite module. It will allow you to attach a layout to particular display under Manage Display in Product Type, after which you can add fields, custom block, Code Field, etc. in your display, which will be visible on node (make variation field display as render entity). Check out Display Suite module documentation for more details on how to customize the display of entity.
    – Yogesh
    Feb 12, 2016 at 17:32

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.