diff --git a/vendor/magento/module-inventory-import-export/Plugin/Import/UpdateConfigurableProductsPlugin.php b/vendor/magento/module-inventory-import-export/Plugin/Import/UpdateConfigurableProductsPlugin.php new file mode 100644 index 00000000000..ca1f54066ab --- /dev/null +++ b/vendor/magento/module-inventory-import-export/Plugin/Import/UpdateConfigurableProductsPlugin.php @@ -0,0 +1,56 @@ +changeParentStockStatus = $changeParentStockStatus; + $this->isSingleSourceMode = $isSingleSourceMode; + } + + /** + * Update configurable products stock item status based on children products stock status after import + * + * @param StockItemImporterInterface $subject + * @param void $result + * @param array $stockData + * @return void + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function afterImport( + StockItemImporterInterface $subject, + $result, + array $stockData + ): void { + if ($stockData && $this->isSingleSourceMode->execute()) { + $this->changeParentStockStatus->execute(array_column($stockData, 'product_id')); + } + } +} diff --git a/vendor/magento/module-inventory-import-export/etc/di.xml b/vendor/magento/module-inventory-import-export/etc/di.xml index 6f0657decfd..5d0db315768 100644 --- a/vendor/magento/module-inventory-import-export/etc/di.xml +++ b/vendor/magento/module-inventory-import-export/etc/di.xml @@ -26,10 +26,10 @@ - - + + @@ -42,7 +42,7 @@ - +