2

Unfortunately I have to ask a pretty vague question, and I can't provide much background because I can't reproduce.

Working on a Drupal 7 Commerce install with Domain Access we are (seemingly) randomly missing shipping and/or billing information on orders. Sometimes the order has a billing name (or shipping name) but no address information. Others, either shipping or billing is completely missing from the order view.

This is happening on ~1% of orders and I can't find any way to link them with consistency. It has happened on PayPal Express Checkout orders, Authorize.net orders, orders with different shipping methods, orders from different domains, etc. The stored API responses from the payment processors are normal.

In testing (on production), I can't reproduce; I've tried both payment methods, anonymous accounts, existing accounts, etc. I can't even get past the Billing/Shipping form without completing all the information, no matter what I've tried.

Hopefully someone has experienced this before; if not, I'm totally open for "try this" or "look here" suggestions.

Thanks

7
  • Ouch, that deja vu hurt. Can't remember exactly what it was - are you using the postcode anywhere module?
    – Clive
    Commented Nov 20, 2014 at 18:15
  • No, not using that module @Clive Commented Nov 20, 2014 at 18:24
  • Not postcodeanywhere_addressfield either by any chance? Double check, a bug identical to this was fixed the other day
    – Clive
    Commented Nov 20, 2014 at 18:25
  • Unfortunately no, here is drush pml --no-core --status=enabled: pastebin.com/ar5mkpJ3 Commented Nov 20, 2014 at 18:33
  • Last one I've got...do you have a "copy billing/shipping address" feature provided by a contrib module?
    – Clive
    Commented Nov 20, 2014 at 19:35

1 Answer 1

3

I've had similar problems before, never did get to the bottom of it. I think it's related to the Commerce Addressbook module and the way it copies profiles but time ran out before I could confirm.

As a rather hacky (but effective) workaround I used the following to make sure the profile had been copied:

function MYMODULE_form_commerce_checkout_form_checkout_alter(&$form, &$form_state, $form_id) {
  $form['buttons']['continue']['#submit'][] = 'MYMODULE_commerce_checkout_form_submit';
}

function MYMODULE_commerce_checkout_form_submit($form, &$form_state) {
  // If the copy address checkbox is selected.
  if ($form_state['values']['customer_profile_shipping']['commerce_customer_profile_copy']) {
    $order_wrapper = entity_metadata_wrapper('commerce_order', $form_state['order']);
    $shipping_address = $order_wrapper->commerce_customer_shipping->commerce_customer_address->raw();
    $billing_address = $order_wrapper->commerce_customer_billing->commerce_customer_address->raw();

    // If the shipping and billing address aren't the same then we need to fix it.
    if ($shipping_address != $billing_address) {
      $order_wrapper->commerce_customer_shipping->commerce_customer_address = $billing_address;
      $order_wrapper->commerce_customer_shipping->save();
    }
  }
}

It may or may not work as-is, but even if not it might provide a starting point for debugging.

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.