I'm searching for the spot, where the price field validation is done as I want to do some more checks here. But I only found the commerce_product_product_form_validate function which is only doing the sku check, but not price. If anyone can point me to the right file / function I would be very glad.

  • You'll find information on that in this thread drupal.stackexchange.com/questions/22952/… – Pontus Nilsson Aug 6 '14 at 7:40
  • My problem is, that I don't want to add a new validation but edit the old one which is checking for required fields. But I can't find where this is done. Commerce isn't using form_alter as far as I found out. – Andi Aug 6 '14 at 7:48
  • What exactly do you want to change? Changing a modules default behavior by editing the modules code is a big no no :) – Pontus Nilsson Aug 6 '14 at 7:52
  • I know. But I want price to be an non-mandatory field. As this isn't possible I have to change the check to set the price to a default value (0) when no price is set. I'm now on a workaround with a core-hack in drupals form.inc, which is pretty bad, but as commerce isn't giving me the chance to set a default price I'm stuck with that :( – Andi Aug 6 '14 at 8:12
  • Or is there a chance to bring in the standard _form_validate into commerce as an override? – Andi Aug 6 '14 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.