0

Following this old checkout_pane_example.module tutorial, I created a custom Drupal 7 Commerce checkout pane. It's simply a text field to collect special order instructions from the customer.

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

  $pane_form['nickname'] = array(
    '#type' => 'textfield', 
    '#title' => t('Your nickname'), 
    '#description' => t("We'd like to call you by your nickname."), 
    '#default_value' => !empty($order->data['nickname']) ? $order->data['nickname'] : '', 
    '#required' => TRUE,
  );

  return $pane_form;
}

The pane works fine. Anything that's saved in the text area is then stored in $order->data['nickname'].

The problem is that I need to access the data in Rules so I can attach it to the existing email that's sent out on order completion email.

How can I access or expose that data via the Rules module?

0

1 Answer 1

1

You can't really expose data as such, but you can define your own order property via hook_entity_property_info() with a custom callback that returns the specific value from the data array you want.

For an example, take a look at commerce_order_entity_property_info()'s definition of the mail_username property and the related commerce_order_get_properties() callback.

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.