Vote up!
Vote down!

How do I change the price label on the product add / edit form?

Is there any way to change the price label? Not the one displayed when viewing a product but the one shown when adding a product variation. I would like also to add a description, for the website editor.

Asked by: heyyo
on April 4, 2013

2 Answers

Vote up!
Vote down!

Unfortunately, the default price fields (machine-name commerce_price) on product types cannot be changed via the user interface. In Drupal 7, you can lock fields to prevent them from being deleted, which was essential to the product data model in Drupal Commerce. However, locking them also prevents the widget settings from being changed - including the label and description. I opened a bug report a while ago to address some of the deficiencies in the locking system, but it's still open.

At this point, your only recourse is to use Drupal's hook_form_alter() to alter the product form and make the desired changes to the label / description. If you just need to alter the default product edit form, its form ID is commerce_product_ui_product_form. However, if you're using the Inline Entity Form (as in Kickstart 2.x), you'll end up having to modify the node edit form itself, which will be a little more complex.

Ryan Szrama
Answer by: Ryan Szrama
Posted: Apr 5, 2013
Vote up!
Vote down!

Thanks for your answer Ryan. I will do that.

I also need to display another label for quantity field for one of my line item type, what the best way to do that.


I saw that Kickstart is also altering this label with hook_form_alter, so I tried to do the same but Kickstart alter is executed after mine, so my alter is useless.

Is there any way to prioritize this altering process ?

Answer by: heyyo
Posted: Apr 7, 2013