Skip to content

Commit ca0fe6e

Browse files
author
Mastiuhin Olexandr
committed
MC-17524: Child product is not addable to Cart from PLP if it does not have default source assigned
1 parent 616b243 commit ca0fe6e

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

app/code/Magento/GroupedCatalogInventory/Plugin/OutOfStockFilter.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,8 @@ public function afterPrepareForCartAdvanced(Grouped $subject, $result, DataObjec
5050
// Only remove out-of-stock products if no quantities were specified
5151
if (is_array($result) && !empty($result) && !$buyRequest->getData('super_group')) {
5252
foreach ($result as $index => $cartItem) {
53-
$prodId = $cartItem->getId();
54-
$productStockStatus = $this->stockRegistry->getProductStockStatus($prodId);
55-
if ($productStockStatus == StockStatusInterface::STATUS_OUT_OF_STOCK) {
53+
$productStockStatus = $this->stockRegistry->getProductStockStatus($cartItem->getId());
54+
if ($productStockStatus === StockStatusInterface::STATUS_OUT_OF_STOCK) {
5655
unset($result[$index]);
5756
}
5857
}

app/code/Magento/GroupedCatalogInventory/Test/Unit/Plugin/OutOfStockFilterTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Magento\GroupedProduct\Model\Product\Type\Grouped;
1717
use PHPUnit\Framework\MockObject\MockObject;
1818
use PHPUnit\Framework\TestCase;
19-
2019
use Magento\CatalogInventory\Api\StockRegistryInterface;
2120

2221
/**

0 commit comments

Comments
 (0)