Skip to content

Commit 53f71f9

Browse files
committed
MAGETWO-61095: When attempting to place a reorder after a product is disabled, product still gets added to the cart
1 parent 371feda commit 53f71f9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Magento\CatalogInventory\Api\StockRegistryInterface;
1111
use Magento\CatalogInventory\Api\StockStateInterface;
12+
use Magento\CatalogInventory\Model\Stock;
1213
use Magento\Framework\Exception\LocalizedException;
1314
use Magento\CatalogInventory\Api\Data\StockItemInterface;
1415
use Magento\CatalogInventory\Helper\Data;
@@ -133,7 +134,9 @@ public function validate(Observer $observer)
133134
}
134135

135136
if ($stockStatus) {
136-
if (!$stockStatus->getStockStatus() || $parentStockStatus && !$parentStockStatus->getStockStatus()) {
137+
if ($stockStatus->getStockStatus() == Stock::STOCK_OUT_OF_STOCK
138+
|| $parentStockStatus && $parentStockStatus->getStockStatus() == Stock::STOCK_OUT_OF_STOCK
139+
) {
137140
$quoteItem->addErrorInfo(
138141
'cataloginventory',
139142
Data::ERROR_QTY,

0 commit comments

Comments
 (0)