When I am on the checkout page there is a customer information pane with the users email and an edit button. When you click the edit button you are redirected to the users account edit page. If you change the email address on that page you are redirected back to the checkout page. Unfortunately the email on the checkout page is still the old one and if you complete the order all emails get sent to the old address as well.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

StevenJay’s picture

This is a fix I am using. You can add it to any module since it only uses hook_user_update. I haven't done much testing with it so use as a starting point.

/**
 * Implements hook_user_update().
 */
function uc_cart_user_update(&$edit, $account, $category) {
  // Load an order from the session, if available.
  if (isset($_SESSION['cart_order'])) {
    $order = uc_order_load($_SESSION['cart_order']);
    if ($order && (uc_order_status_data($order->order_status, 'state') == 'in_checkout') &&
          ($account->uid == $order->uid)) {
      //update the users primary order email if it has changed
      if ($order->primary_email != $account->mail) {
        $order->primary_email = $account->mail;
        uc_order_save($order);        
      }
    }
  }
}
longwave’s picture

Version: 7.x-3.2 » 7.x-3.x-dev
Status: Active » Needs review
FileSize
2.97 KB

The attached patch fixes this issue, including a test.

longwave’s picture

longwave’s picture

Version: 7.x-3.x-dev » 6.x-2.x-dev
Status: Needs review » Patch (to be ported)

Committed #3, should be ported to 6.x for consistency.

longwave’s picture

Status: Patch (to be ported) » Needs review
FileSize
3.09 KB

Status: Needs review » Needs work

The last submitted patch, 1857618-checkout-email-change.patch, failed testing.

longwave’s picture

Status: Needs work » Needs review
FileSize
3.04 KB
longwave’s picture

longwave’s picture

Status: Needs review » Fixed

Committed to 6.x - even though it's not strictly needed, we get some new tests.

Status: Fixed » Closed (fixed)

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