Skip to content

Commit

Permalink
Merge pull request #1444 from dpfaffenbauer/issue/default-address
Browse files Browse the repository at this point in the history
[2.2][Core] create default address if customer doesn't have one
  • Loading branch information
dpfaffenbauer authored Jul 2, 2020
2 parents bd0cb63 + e6f5099 commit cf08194
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ public function allocateAddressByAffiliation(CustomerInterface $customer, Addres
);
}

//If it's a customer address, and the customer doesn't have one yet, use this address as default and allow it for all types
if ($affiliation === CustomerAddressAllocatorInterface::ADDRESS_AFFILIATION_TYPE_OWN && 0 === count($customer->getAddresses())) {
$address->setAddressIdentifier(null);
$customer->setDefaultAddress($address);
}

$address = $this->customerTransformHelper->moveAddressToNewAddressStack($address, $relationEntity);

return $address;
Expand Down

0 comments on commit cf08194

Please sign in to comment.