Skip to content

Commit 560e1d7

Browse files
committed
Merge remote-tracking branch 'origin/issue-19166' into issue-19166
2 parents 7607c82 + f8a6d05 commit 560e1d7

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

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

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class QuoteManagement implements \Magento\Quote\Api\CartManagementInterface
159159
* @param \Magento\Quote\Api\CartRepositoryInterface $quoteRepository
160160
* @param \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository
161161
* @param \Magento\Customer\Model\CustomerFactory $customerModelFactory
162-
* @param \Magento\Quote\Model\Quote\AddressFactory $quoteAddressFactory,
162+
* @param \Magento\Quote\Model\Quote\AddressFactory $quoteAddressFactory
163163
* @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper
164164
* @param StoreManagerInterface $storeManager
165165
* @param \Magento\Checkout\Model\Session $checkoutSession
@@ -221,7 +221,7 @@ public function __construct(
221221
}
222222

223223
/**
224-
* {@inheritdoc}
224+
* @inheritdoc
225225
*/
226226
public function createEmptyCart()
227227
{
@@ -241,7 +241,7 @@ public function createEmptyCart()
241241
}
242242

243243
/**
244-
* {@inheritdoc}
244+
* @inheritdoc
245245
*/
246246
public function createEmptyCartForCustomer($customerId)
247247
{
@@ -257,7 +257,7 @@ public function createEmptyCartForCustomer($customerId)
257257
}
258258

259259
/**
260-
* {@inheritdoc}
260+
* @inheritdoc
261261
*/
262262
public function assignCustomer($cartId, $customerId, $storeId)
263263
{
@@ -332,7 +332,7 @@ protected function createCustomerCart($customerId, $storeId)
332332
}
333333

334334
/**
335-
* {@inheritdoc}
335+
* @inheritdoc
336336
*/
337337
public function placeOrder($cartId, PaymentInterface $paymentMethod = null)
338338
{
@@ -354,11 +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());
357+
if ($quote->getCustomerFirstname() === null && $quote->getCustomerLastname() === null) {
358+
$quote->setCustomerFirstname($quote->getBillingAddress()->getFirstname());
359+
$quote->setCustomerLastname($quote->getBillingAddress()->getLastname());
360+
if ($quote->getBillingAddress()->getMiddlename() === null) {
361+
$quote->setCustomerMiddlename($quote->getBillingAddress()->getMiddlename());
362+
}
362363
}
363364
$quote->setCustomerIsGuest(true);
364365
$quote->setCustomerGroupId(\Magento\Customer\Api\Data\GroupInterface::NOT_LOGGED_IN_ID);
@@ -385,7 +386,7 @@ public function placeOrder($cartId, PaymentInterface $paymentMethod = null)
385386
}
386387

387388
/**
388-
* {@inheritdoc}
389+
* @inheritdoc
389390
*/
390391
public function getCartForCustomer($customerId)
391392
{
@@ -412,6 +413,8 @@ public function submit(QuoteEntity $quote, $orderData = [])
412413
}
413414

414415
/**
416+
* Resolve items
417+
*
415418
* @param Quote $quote
416419
* @return array
417420
*/

0 commit comments

Comments
 (0)