From a60276269e7f5a6831e583e5ea4350bd3b9b8851 Mon Sep 17 00:00:00 2001 From: Theis Corfixen Date: Wed, 1 Mar 2017 12:40:24 +0100 Subject: [PATCH] Update Stock.php Relates to issue: https://github.com/magento/magento2/issues/8566 A flag set to null will always overwrite the isShowOutOfStock variable. So you can't set the default value from the admin configuration. --- app/code/Magento/CatalogInventory/Helper/Stock.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/CatalogInventory/Helper/Stock.php b/app/code/Magento/CatalogInventory/Helper/Stock.php index fd0a29d038df4..c10b137fe1721 100644 --- a/app/code/Magento/CatalogInventory/Helper/Stock.php +++ b/app/code/Magento/CatalogInventory/Helper/Stock.php @@ -156,7 +156,7 @@ public function addIsInStockFilterToCollection($collection) $resource = $this->getStockStatusResource(); $resource->addStockDataToCollection( $collection, - !$isShowOutOfStock && $collection->getFlag('require_stock_items') + !$isShowOutOfStock || $collection->getFlag('require_stock_items') ); $collection->setFlag($stockFlag, true); }