Skip to content

Commit

Permalink
Merge pull request #1435 from dpfaffenbauer/3.0-features/address-default
Browse files Browse the repository at this point in the history
[Core] create default address if customer doesn't have one
  • Loading branch information
dpfaffenbauer authored Jun 22, 2020
2 parents fc0e3b9 + 0dd966a commit c83056d
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,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 c83056d

Please sign in to comment.