File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed
app/code/Magento/Sales/Model/AdminOrder
dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 /**
You can’t perform that action at this time.
0 commit comments