diff --git a/app/code/Magento/CatalogInventory/Model/ResourceModel/Product/StockStatusBaseSelectProcessor.php b/app/code/Magento/CatalogInventory/Model/ResourceModel/Product/StockStatusBaseSelectProcessor.php index 9f89d380a8f96..b80c26c53a76e 100644 --- a/app/code/Magento/CatalogInventory/Model/ResourceModel/Product/StockStatusBaseSelectProcessor.php +++ b/app/code/Magento/CatalogInventory/Model/ResourceModel/Product/StockStatusBaseSelectProcessor.php @@ -56,7 +56,9 @@ public function process(Select $select) ['stock' => $stockStatusTable], sprintf('stock.product_id = %s.entity_id', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS), [] - )->where('stock.stock_status = ?', Stock::STOCK_IN_STOCK); + ) + ->where('stock.stock_status = ?', Stock::STOCK_IN_STOCK) + ->where('stock.website_id = ?', 0); } return $select; diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/ResourceModel/Product/StockStatusBaseSelectProcessorTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/ResourceModel/Product/StockStatusBaseSelectProcessorTest.php index 9a46dc99ee008..0598fe7e9fe71 100644 --- a/app/code/Magento/CatalogInventory/Test/Unit/Model/ResourceModel/Product/StockStatusBaseSelectProcessorTest.php +++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/ResourceModel/Product/StockStatusBaseSelectProcessorTest.php @@ -56,9 +56,13 @@ public function testProcess() [] ) ->willReturnSelf(); - $this->select->expects($this->once()) + + $this->select->expects($this->exactly(2)) ->method('where') - ->with('stock.stock_status = ?', Stock::STOCK_IN_STOCK) + ->withConsecutive( + ['stock.stock_status = ?', Stock::STOCK_IN_STOCK, null], + ['stock.website_id = ?', 0, null] + ) ->willReturnSelf(); $this->stockStatusBaseSelectProcessor->process($this->select);