@@ -159,7 +159,7 @@ class QuoteManagement implements \Magento\Quote\Api\CartManagementInterface
159
159
* @param \Magento\Quote\Api\CartRepositoryInterface $quoteRepository
160
160
* @param \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository
161
161
* @param \Magento\Customer\Model\CustomerFactory $customerModelFactory
162
- * @param \Magento\Quote\Model\Quote\AddressFactory $quoteAddressFactory,
162
+ * @param \Magento\Quote\Model\Quote\AddressFactory $quoteAddressFactory
163
163
* @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper
164
164
* @param StoreManagerInterface $storeManager
165
165
* @param \Magento\Checkout\Model\Session $checkoutSession
@@ -221,7 +221,7 @@ public function __construct(
221
221
}
222
222
223
223
/**
224
- * { @inheritdoc}
224
+ * @inheritdoc
225
225
*/
226
226
public function createEmptyCart ()
227
227
{
@@ -241,7 +241,7 @@ public function createEmptyCart()
241
241
}
242
242
243
243
/**
244
- * { @inheritdoc}
244
+ * @inheritdoc
245
245
*/
246
246
public function createEmptyCartForCustomer ($ customerId )
247
247
{
@@ -257,7 +257,7 @@ public function createEmptyCartForCustomer($customerId)
257
257
}
258
258
259
259
/**
260
- * { @inheritdoc}
260
+ * @inheritdoc
261
261
*/
262
262
public function assignCustomer ($ cartId , $ customerId , $ storeId )
263
263
{
@@ -332,7 +332,7 @@ protected function createCustomerCart($customerId, $storeId)
332
332
}
333
333
334
334
/**
335
- * { @inheritdoc}
335
+ * @inheritdoc
336
336
*/
337
337
public function placeOrder ($ cartId , PaymentInterface $ paymentMethod = null )
338
338
{
@@ -354,11 +354,12 @@ public function placeOrder($cartId, PaymentInterface $paymentMethod = null)
354
354
if ($ quote ->getCheckoutMethod () === self ::METHOD_GUEST ) {
355
355
$ quote ->setCustomerId (null );
356
356
$ 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
+ }
362
363
}
363
364
$ quote ->setCustomerIsGuest (true );
364
365
$ quote ->setCustomerGroupId (\Magento \Customer \Api \Data \GroupInterface::NOT_LOGGED_IN_ID );
@@ -385,7 +386,7 @@ public function placeOrder($cartId, PaymentInterface $paymentMethod = null)
385
386
}
386
387
387
388
/**
388
- * { @inheritdoc}
389
+ * @inheritdoc
389
390
*/
390
391
public function getCartForCustomer ($ customerId )
391
392
{
@@ -412,6 +413,8 @@ public function submit(QuoteEntity $quote, $orderData = [])
412
413
}
413
414
414
415
/**
416
+ * Resolve items
417
+ *
415
418
* @param Quote $quote
416
419
* @return array
417
420
*/
0 commit comments