Skip to content

Commit bce574c

Browse files
committed
MAGETWO-54262: Cannot remove product from shopping cart
- This reverts commit b9e0026.
1 parent a8942a0 commit bce574c

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ public function validate(\Magento\Framework\Event\Observer $observer)
183183
\Magento\CatalogInventory\Helper\Data::ERROR_QTY,
184184
$result->getMessage()
185185
);
186+
187+
$quoteItem->getQuote()->addErrorInfo(
188+
$result->getQuoteMessageIndex(),
189+
'cataloginventory',
190+
\Magento\CatalogInventory\Helper\Data::ERROR_QTY,
191+
$result->getQuoteMessage()
192+
);
186193
} else {
187194
// Delete error from item and its quote, if it was set due to qty lack
188195
$this->_removeErrorsFromQuoteAndItem($quoteItem, \Magento\CatalogInventory\Helper\Data::ERROR_QTY);

app/code/Magento/Checkout/Block/Cart.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,12 @@ public function prepareItemUrls()
108108
}
109109

110110
/**
111+
* @codeCoverageIgnore
111112
* @return bool
112113
*/
113114
public function hasError()
114115
{
115-
if ($this->getQuote()->getHasError()) {
116-
return true;
117-
}
118-
119-
foreach ($this->getQuote()->getItems() as $quoteItem) {
120-
if (!empty($quoteItem->getErrorInfos())) {
121-
return true;
122-
}
123-
}
124-
return false;
116+
return $this->getQuote()->getHasError();
125117
}
126118

127119
/**

0 commit comments

Comments
 (0)