diff --git a/app/code/Magento/Quote/Model/Quote/Item/CartItemPersister.php b/app/code/Magento/Quote/Model/Quote/Item/CartItemPersister.php index 85d3ccb3396ee..b2247f333bc3a 100644 --- a/app/code/Magento/Quote/Model/Quote/Item/CartItemPersister.php +++ b/app/code/Magento/Quote/Model/Quote/Item/CartItemPersister.php @@ -71,7 +71,9 @@ public function save(CartInterface $quote, CartItemInterface $item) /** Update item product options */ $item = $quote->updateItem($itemId, $buyRequestData); } else { - $currentItem->setQty($qty); + if ($item->getQty() !== $currentItem->getQty()) { + $currentItem->setQty($qty); + } } } else { /** add new item to shopping cart */ diff --git a/app/code/Magento/Quote/Model/QuoteRepository/SaveHandler.php b/app/code/Magento/Quote/Model/QuoteRepository/SaveHandler.php index 6b06dbc8c8f13..1bece9a0887ca 100644 --- a/app/code/Magento/Quote/Model/QuoteRepository/SaveHandler.php +++ b/app/code/Magento/Quote/Model/QuoteRepository/SaveHandler.php @@ -5,10 +5,8 @@ */ namespace Magento\Quote\Model\QuoteRepository; -use Magento\Framework\App\ObjectManager; use Magento\Quote\Api\Data\CartInterface; use Magento\Framework\Exception\InputException; -use Magento\Framework\Exception\CouldNotSaveException; class SaveHandler { @@ -32,11 +30,6 @@ class SaveHandler */ private $shippingAssignmentPersister; - /** - * @var \Magento\Framework\Message\PhraseFactory - */ - private $phraseFactory; - /** * @param \Magento\Quote\Model\ResourceModel\Quote $quoteResource * @param \Magento\Quote\Model\Quote\Item\CartItemPersister $cartItemPersister @@ -77,13 +70,6 @@ public function save(CartInterface $quote) } } } - $errors = $quote->getErrors(); - if (!empty($errors)) { - $phraseFactory = $this->getPhraseFactory(); - throw new CouldNotSaveException( - $phraseFactory->create('Following errors occurred on save: %1', $errors) - ); - } // Billing Address processing $billingAddress = $quote->getBillingAddress(); @@ -97,18 +83,6 @@ public function save(CartInterface $quote) return $quote; } - /** - * @deprecated - * @return \Magento\Framework\Message\PhraseFactory - */ - private function getPhraseFactory() - { - if (!is_object($this->phraseFactory)) { - $this->phraseFactory = ObjectManager::getInstance()->get(\Magento\Framework\Message\PhraseFactory::class); - } - return $this->phraseFactory; - } - /** * @param \Magento\Quote\Model\Quote $quote * @return void