I've added custom "markup" field to the commerce_product table, next I've implemented hook_form_FORM-ID_alter, but submit function doesn't executed.

  • Welcome to Drupal Answers! Please remove the code that is not necessary to answer the question. Knowing you implement other hooks is not necessary to answer your question. – kiamlaluno Jul 17 '14 at 15:35
  • Ok, but why don't You answer? – Artreaktor Jul 18 '14 at 7:04
  • Can you call debug($form) or dpm($form) (if devel is installed) in your hook_form_alter() and check the submit function that is specified? – Wtower Jul 18 '14 at 7:22
  • Custom submit function in it's place, but not invoked. (dl.dropboxusercontent.com/u/42690200/form-submit.PNG) – Artreaktor Jul 18 '14 at 10:57

If you add the custom field through hook_form_alter. You need to store the data manually in your custom table by using your custom submit handler.. Otherwise you could use the below code in your *.install file

function MYMODULE_enable() {
  // Check if our field is not already created.
  if (!field_info_field('field_myField')) {

    // Create the field base.
    $field = array(
      'field_name' => 'field_myField', 
      'type' => 'text', 

    // Create the field instance on the bundle.
    $instance = array(
      'field_name' => 'field_myField', 
      'entity_type' => 'user', 
      'label' => 'My Field Name', 
      'bundle' => 'user', 
      // If you don't set the "required" property then the field wont be required by default.
      'required' => TRUE,
      'settings' => array(
        // Here you inform either or not you want this field showing up on the registration form.
        'user_register_form' => 1,
      'widget' => array(
        'type' => 'textfield',
| improve this answer | |

Your Answer

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

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