I want to create orders programatically in my custom form.

I would like to have addressbook form fields in this form too.

I noticed, that address fields are added in hook_form_alter, but there are many conditions and added variables, which doesn't exists in my custom form (checkout ID, existing customer profile).

Is it possible to display address fields in my custom form and attach address directly to one order?

Comments

jsacksick’s picture

Status: Active » Fixed

I'm not sure this issue is in the correct issue queue because the addressbook module only adds a select list...
The code that does that is located in the commerce_customer.checkout_pane.inc file in commerce/modules/customer/includes.
Especially those two lines :


  // Create a new profile of the specified type if it hasn't already been made.
  if (empty($profile)) {
    $profile = commerce_customer_profile_new($type, $order->uid);
  }
  // Add the field widgets for the profile.
  field_attach_form('commerce_customer_profile', $profile, $pane_form, $form_state);

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.