Skip to content

Commit 3929bf2

Browse files
Stanislav IdolovSerhiy Shkolyarenko
authored andcommitted
MAGETWO-33580: There is no ability to place order for guest customer using API service
1 parent 62ef409 commit 3929bf2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,15 @@ protected function createCustomerCart($storeId)
236236
public function placeOrder($cartId)
237237
{
238238
$quote = $this->quoteRepository->getActive($cartId);
239-
$order = $this->submit($quote);
240-
return $order->getId();
239+
240+
if ($quote->getCheckoutMethod() == \Magento\Checkout\Model\Type\Onepage::METHOD_GUEST) {
241+
$quote->setCustomerId(null);
242+
$quote->setCustomerEmail($quote->getBillingAddress()->getEmail());
243+
$quote->setCustomerIsGuest(true);
244+
$quote->setCustomerGroupId(\Magento\Customer\Api\Data\GroupInterface::NOT_LOGGED_IN_ID);
245+
}
246+
247+
return $this->submit($quote)->getId();
241248
}
242249

243250
/**

0 commit comments

Comments
 (0)