I created a custom checkout pane with Drupal Commerce so if a user checkouts as anonymous they can create an account on the checkout completion page. The problem is that when in my form's submit function the form_state values are not passed and I get an undefined index error. Here is the code for the checkout form:

function commerce_checkout_complete_registration_pane_checkout_form($form, &$form_state, $checkout_pane, $order) {

      $form['new_email'] = array(
        '#type' => 'textfield',
        '#title' => t('Email'),
        '#element_validate' => array('_validate_the_email'),

      $form['pass'] = array(
        '#type' => 'password_confirm',

      $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Register'),
        '#submit' => array('commerce_checkout_complete_registration_pane_checkout_form_submit'),

      global $user;
      if($user->uid == 0){
        return $form;


And here is the submit function:

function commerce_checkout_complete_registration_pane_checkout_form_submit($form, &$form_state, $checkout_pane, $order) {
  $email_address = $form_state['values']['new_email'];
  syslog(1, $email_address . 'TEST');

1 Answer 1


The function "commerce_checkout_complete_registration_pane_checkout_form" needed to have the $form variable passed as a reference, &$form.

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.