From 12bc1295df6aec1fd0b77dd0bf175fbcd6b68b8c Mon Sep 17 00:00:00 2001 From: RikvdHeijden Date: Mon, 4 Jul 2022 11:37:19 +0200 Subject: [PATCH] Remove erronious check The isUseConfigManageStock variable only describes whether or not the stockItemConfiguration uses the default config value or the stockItemConfiguration specific config value for this the isManageStock value. It does not say anything about the value of the manage_stock setting. Since this logic is already correctly implemented in the getManageStock function this line can be completely removed. As it was the line causes a bug where every PUT call to /products/{sku}/stockItems/{stock_item} endpoint with a use_config_manage_stock value of false will always cause that stockItem to register as in_stock until a reindex is run. As it is right now this call will still set products in_stock when Manage stock is disabled. I don't know enough about that workflow to determine if that is the correct behavior. --- .../Api/StockRegistry/AdaptUpdateStockStatusBySkuPlugin.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/InventoryCatalog/Plugin/CatalogInventory/Api/StockRegistry/AdaptUpdateStockStatusBySkuPlugin.php b/InventoryCatalog/Plugin/CatalogInventory/Api/StockRegistry/AdaptUpdateStockStatusBySkuPlugin.php index afe66fea814..75f9958cbaa 100644 --- a/InventoryCatalog/Plugin/CatalogInventory/Api/StockRegistry/AdaptUpdateStockStatusBySkuPlugin.php +++ b/InventoryCatalog/Plugin/CatalogInventory/Api/StockRegistry/AdaptUpdateStockStatusBySkuPlugin.php @@ -85,9 +85,7 @@ public function afterUpdateStockItemBySku( $productType = $this->getProductTypesBySkus->execute([$productSku])[$productSku]; $stockItemConfiguration = $this->getStockItemConfiguration->execute($productSku, Stock::DEFAULT_STOCK_ID); - if ($stockItemConfiguration->isManageStock() === false - || $stockItemConfiguration->isUseConfigManageStock() === false - ) { + if ($stockItemConfiguration->isManageStock() === false) { $this->setDataToLegacyStockStatus->execute($productSku, (float)$stockItem->getQty(), 1); } else { if ($this->isSourceItemManagementAllowedForProductType->execute($productType)