Skip to content

Commit 8c083f7

Browse files
committed
ACP2E-3296: Checkout order email confirmation is sent to emails entered in First/Last name
1 parent 9703475 commit 8c083f7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

app/code/Magento/Quote/Model/CustomerManagement.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ public function validateAddresses(QuoteEntity $quote)
158158
$addresses[] = $this->customerAddressRepository->getById(
159159
$quote->getShippingAddress()->getCustomerAddressId()
160160
);
161-
} else {
161+
}
162+
if (empty($addresses) && $quote->getCustomerIsGuest()) {
162163
$billingAddress = $quote->getBillingAddress();
163164
$customerAddress = $this->customerAddressFactory->create();
164165
$customerAddress->setFirstname($billingAddress->getFirstname());
@@ -171,7 +172,6 @@ public function validateAddresses(QuoteEntity $quote)
171172
$customerAddress->setCustomAttributes($billingAddress->getCustomAttributes());
172173
$addresses[] = $customerAddress;
173174
}
174-
175175
foreach ($addresses as $address) {
176176
$validator = $this->validatorFactory->createValidator('customer_address', 'save');
177177
$addressModel = $this->addressFactory->create();

app/code/Magento/Quote/Test/Unit/Model/CustomerManagementTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ protected function setUp(): void
114114
);
115115
$this->quoteMock = $this->getMockBuilder(Quote::class)
116116
->addMethods(['getPasswordHash'])
117-
->onlyMethods(['getId', 'getCustomer', 'getBillingAddress', 'getShippingAddress', 'setCustomer'])
117+
->onlyMethods(['getId', 'getCustomer', 'getBillingAddress', 'getShippingAddress', 'setCustomer', 'getCustomerIsGuest'])
118118
->disableOriginalConstructor()
119119
->getMock();
120120
$this->quoteAddressMock = $this->createMock(Address::class);
@@ -267,6 +267,7 @@ public function testValidateAddresses()
267267
public function testValidateAddressesNotSavedInAddressBook()
268268
{
269269
$this->expectException(ValidatorException::class);
270+
$this->quoteMock->method('getCustomerIsGuest')->willReturn(true);
270271
$this->quoteAddressMock->method('getStreet')->willReturn(['test']);
271272
$this->quoteAddressMock->method('getCustomAttributes')->willReturn(['test']);
272273
$this->customerAddressFactoryMock->method('create')

0 commit comments

Comments
 (0)