diff -Nuar a/vendor/magento/module-inventory-configuration/Plugin/InventoryConfiguration/Model/GetLegacyStockItemCache.php b/vendor/magento/module-inventory-configuration/Plugin/InventoryConfiguration/Model/GetLegacyStockItemCache.php index 6ef9784fc19..46538612d80 100644 --- a/vendor/magento/module-inventory-configuration/Plugin/InventoryConfiguration/Model/GetLegacyStockItemCache.php +++ b/vendor/magento/module-inventory-configuration/Plugin/InventoryConfiguration/Model/GetLegacyStockItemCache.php @@ -31,10 +31,17 @@ class GetLegacyStockItemCache */ public function aroundExecute(GetLegacyStockItem $subject, callable $proceed, string $sku): StockItemInterface { - if (!isset($this->legacyStockItemsBySku[$sku])) { - $this->legacyStockItemsBySku[$sku] = $proceed($sku); + if (isset($this->legacyStockItemsBySku[$sku])) { + return $this->legacyStockItemsBySku[$sku]; } - return $this->legacyStockItemsBySku[$sku]; + /** @var StockItemInterface $item */ + $item = $proceed($sku); + /* Avoid add to cache a new item */ + if ($item->getItemId()) { + $this->legacyStockItemsBySku[$sku] = $item; + } + + return $item; } } diff -Nuar a/vendor/magento/module-inventory-reservation-cli/Model/SalableQuantityInconsistency/FilterUnresolvedReservations.php b/vendor/magento/module-inventory-reservation-cli/Model/SalableQuantityInconsistency/FilterUnresolvedReservations.php index 933350b80fb..531313b5d04 100644 --- a/vendor/magento/module-inventory-reservation-cli/Model/SalableQuantityInconsistency/FilterUnresolvedReservations.php +++ b/vendor/magento/module-inventory-reservation-cli/Model/SalableQuantityInconsistency/FilterUnresolvedReservations.php @@ -16,13 +16,21 @@ class FilterUnresolvedReservations { /** * Remove all compensated reservations + * * @param SalableQuantityInconsistency[] $inconsistencies * @return SalableQuantityInconsistency[] */ public function execute(array $inconsistencies): array { foreach ($inconsistencies as $inconsistency) { - $inconsistency->setItems(array_filter($inconsistency->getItems())); + $inconsistency->setItems( + array_filter( + $inconsistency->getItems(), + function ($qty) { + return $qty > 0; + } + ) + ); } return array_filter(