Skip to content

Commit a80fa10

Browse files
committed
MC-35161: No Payment method is showing in Admin Create Order for one website only.
1 parent d1bf3a3 commit a80fa10

File tree

2 files changed

+8
-10
lines changed
  • app/code/Magento/Sales/Model/AdminOrder
  • dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder

2 files changed

+8
-10
lines changed

app/code/Magento/Sales/Model/AdminOrder/Create.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -745,10 +745,12 @@ public function getCustomerCart()
745745
try {
746746
$this->_cart = $this->quoteRepository->getForCustomer($customerId, [$storeId]);
747747
} catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
748-
$this->_cart->setStore($this->getSession()->getStore());
749-
$customerData = $this->customerRepository->getById($customerId);
750-
$this->_cart->assignCustomer($customerData);
751-
$this->quoteRepository->save($this->_cart);
748+
if ($this->getQuote()->hasItems()) {
749+
$this->_cart->setStore($this->getSession()->getStore());
750+
$customerData = $this->customerRepository->getById($customerId);
751+
$this->_cart->assignCustomer($customerData);
752+
$this->quoteRepository->save($this->_cart);
753+
}
752754
}
753755
}
754756

dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -693,12 +693,8 @@ public function testGetCustomerCartNewCart()
693693

694694
/** SUT execution */
695695
$customerQuote = $this->model->getCustomerCart();
696-
self::assertNotEmpty($customerQuote->getId(), 'Quote ID is invalid.');
697-
self::assertEquals(
698-
$customerEmailFromFixture,
699-
$customerQuote->getCustomerEmail(),
700-
'Customer data is preserved incorrectly in a newly quote.'
701-
);
696+
self::assertInstanceOf(Quote::class, $customerQuote);
697+
self::assertEmpty($customerQuote->getData());
702698
}
703699

704700
/**

0 commit comments

Comments
 (0)