Skip to content

Commit ccba420

Browse files
committed
Customer related values are NULL for guests
1 parent 2a389b0 commit ccba420

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,12 @@ public function placeOrder($cartId, PaymentInterface $paymentMethod = null)
354354
if ($quote->getCheckoutMethod() === self::METHOD_GUEST) {
355355
$quote->setCustomerId(null);
356356
$quote->setCustomerEmail($quote->getBillingAddress()->getEmail());
357+
$quote->setCustomerFirstname($quote->getBillingAddress()->getFirstname());
358+
$quote->setCustomerLastname($quote->getBillingAddress()->getLastname());
359+
360+
if ($quote->getBillingAddress()->getMiddlename()) {
361+
$quote->setCustomerMiddlename($quote->getBillingAddress()->getMiddlename());
362+
}
357363
$quote->setCustomerIsGuest(true);
358364
$quote->setCustomerGroupId(\Magento\Customer\Api\Data\GroupInterface::NOT_LOGGED_IN_ID);
359365
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ public function testPlaceOrderIfCustomerIsGuest()
644644

645645
$addressMock = $this->createPartialMock(\Magento\Quote\Model\Quote\Address::class, ['getEmail']);
646646
$addressMock->expects($this->once())->method('getEmail')->willReturn($email);
647-
$this->quoteMock->expects($this->once())->method('getBillingAddress')->with()->willReturn($addressMock);
647+
$this->quoteMock->expects($this->any())->method('getBillingAddress')->with()->willReturn($addressMock);
648648

649649
$this->quoteMock->expects($this->once())->method('setCustomerIsGuest')->with(true)->willReturnSelf();
650650
$this->quoteMock->expects($this->once())

0 commit comments

Comments
 (0)