Skip to content

Commit

Permalink
Customer related values are NULL for guests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nazar65 committed Nov 13, 2018
1 parent 2a389b0 commit ccba420
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions app/code/Magento/Quote/Model/QuoteManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@ public function placeOrder($cartId, PaymentInterface $paymentMethod = null)
if ($quote->getCheckoutMethod() === self::METHOD_GUEST) {
$quote->setCustomerId(null);
$quote->setCustomerEmail($quote->getBillingAddress()->getEmail());
$quote->setCustomerFirstname($quote->getBillingAddress()->getFirstname());
$quote->setCustomerLastname($quote->getBillingAddress()->getLastname());

if ($quote->getBillingAddress()->getMiddlename()) {
$quote->setCustomerMiddlename($quote->getBillingAddress()->getMiddlename());
}
$quote->setCustomerIsGuest(true);
$quote->setCustomerGroupId(\Magento\Customer\Api\Data\GroupInterface::NOT_LOGGED_IN_ID);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ public function testPlaceOrderIfCustomerIsGuest()

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

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

0 comments on commit ccba420

Please sign in to comment.