diff --git a/vendor/magento/module-inventory-cache/Model/FlushCacheByCategoryIds.php b/vendor/magento/module-inventory-cache/Model/FlushCacheByCategoryIds.php
new file mode 100644
index 00000000000..8127b9bc3cf
--- /dev/null
+++ b/vendor/magento/module-inventory-cache/Model/FlushCacheByCategoryIds.php
@@ -0,0 +1,72 @@
+cacheContextFactory = $cacheContextFactory;
+ $this->eventManager = $eventManager;
+ $this->categoryCacheTag = $categoryCacheTag;
+ $this->appCache = $appCache;
+ }
+
+ /**
+ * Clean cache for given category ids.
+ *
+ * @param array $categoryIds
+ * @return void
+ */
+ public function execute(array $categoryIds): void
+ {
+ if ($categoryIds) {
+ $cacheContext = $this->cacheContextFactory->create();
+ $cacheContext->registerEntities($this->categoryCacheTag, $categoryIds);
+ $this->eventManager->dispatch('clean_cache_by_tags', ['object' => $cacheContext]);
+ $this->appCache->clean($cacheContext->getIdentities());
+ }
+ }
+}
\ No newline at end of file
diff --git a/vendor/magento/module-inventory-cache/Model/ResourceModel/GetProductIdsByStockIds.php b/vendor/magento/module-inventory-cache/Model/ResourceModel/GetProductIdsByStockIds.php
deleted file mode 100644
index ec148eaba8c..00000000000
--- a/vendor/magento/module-inventory-cache/Model/ResourceModel/GetProductIdsByStockIds.php
+++ /dev/null
@@ -1,87 +0,0 @@
-resource = $resource;
- $this->defaultStockProvider = $defaultStockProvider;
- $this->stockIndexTableNameResolver = $stockIndexTableNameResolver;
- $this->productTableName = $productTableName;
- }
-
- /**
- * Get product ids for given stock form index table.
- *
- * @param array $stockIds
- * @return array
- */
- public function execute(array $stockIds): array
- {
- $productIds = [[]];
- foreach ($stockIds as $stockId) {
- if ($this->defaultStockProvider->getId() === (int)$stockId) {
- continue;
- }
- $stockIndexTableName = $this->stockIndexTableNameResolver->execute($stockId);
- $connection = $this->resource->getConnection();
-
- $sql = $connection->select()
- ->from(['stock_index' => $stockIndexTableName], [])
- ->join(
- ['product' => $this->resource->getTableName($this->productTableName)],
- 'product.sku = stock_index.' . IndexStructure::SKU,
- ['product.entity_id']
- );
- $productIds[] = $connection->fetchCol($sql);
- }
- $productIds = array_merge(...$productIds);
-
- return array_unique($productIds);
- }
-}
diff --git a/vendor/magento/module-inventory-cache/Plugin/InventoryIndexer/Indexer/Source/SourceItemIndexer/CacheFlush.php b/vendor/magento/module-inventory-cache/Plugin/InventoryIndexer/Indexer/Source/SourceItemIndexer/CacheFlush.php
deleted file mode 100644
index 5da92eb0d8b..00000000000
--- a/vendor/magento/module-inventory-cache/Plugin/InventoryIndexer/Indexer/Source/SourceItemIndexer/CacheFlush.php
+++ /dev/null
@@ -1,55 +0,0 @@
-flushCacheByIds = $flushCacheByIds;
- $this->getProductIdsBySourceItemIds = $getProductIdsBySourceItemIds;
- }
-
- /**
- * Clean cache for specific products after source items reindex.
- *
- * @param SourceItemIndexer $subject
- * @param array $sourceItemIds
- * @param null $result
- * @throws \Exception in case catalog product entity type hasn't been initialize.
- * @SuppressWarnings(PHPMD.UnusedFormalParameter)
- */
- public function afterExecuteList(SourceItemIndexer $subject, $result, array $sourceItemIds)
- {
- $productIds = $this->getProductIdsBySourceItemIds->execute($sourceItemIds);
- $this->flushCacheByIds->execute($productIds);
- }
-}
diff --git a/vendor/magento/module-inventory-cache/Plugin/InventoryIndexer/Indexer/SourceItem/Strategy/Sync/CacheFlush.php b/vendor/magento/module-inventory-cache/Plugin/InventoryIndexer/Indexer/SourceItem/Strategy/Sync/CacheFlush.php
new file mode 100644
index 00000000000..4a45d9e665a
--- /dev/null
+++ b/vendor/magento/module-inventory-cache/Plugin/InventoryIndexer/Indexer/SourceItem/Strategy/Sync/CacheFlush.php
@@ -0,0 +1,75 @@
+flushCacheByIds = $flushCacheByIds;
+ $this->getProductIdsBySourceItemIds = $getProductIdsBySourceItemIds;
+ $this->getCategoryIdsByProductIds = $getCategoryIdsByProductIds;
+ $this->flushCategoryByCategoryIds = $flushCategoryByCategoryIds;
+ }
+
+ /**
+ * Clean cache for specific products after source items reindex.
+ *
+ * @param Sync $subject
+ * @param void $result
+ * @param array $sourceItemIds
+ * @throws \Exception in case catalog product entity type hasn't been initialize.
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ */
+ public function afterExecuteList(Sync $subject, $result, array $sourceItemIds)
+ {
+ $productIds = $this->getProductIdsBySourceItemIds->execute($sourceItemIds);
+ $categoryIds = $this->getCategoryIdsByProductIds->execute($productIds);
+ $this->flushCategoryByCategoryIds->execute($categoryIds);
+ $this->flushCacheByIds->execute($productIds);
+ }
+}
\ No newline at end of file
diff --git a/vendor/magento/module-inventory-cache/Plugin/InventoryIndexer/Indexer/Stock/StockIndexer/CacheFlush.php b/vendor/magento/module-inventory-cache/Plugin/InventoryIndexer/Indexer/Stock/StockIndexer/CacheFlush.php
deleted file mode 100644
index 8f050f1b94a..00000000000
--- a/vendor/magento/module-inventory-cache/Plugin/InventoryIndexer/Indexer/Stock/StockIndexer/CacheFlush.php
+++ /dev/null
@@ -1,61 +0,0 @@
-flushCacheByProductIds = $flushCacheByProductIds;
- $this->getProductIdsByStockIds = $getProductIdsForCacheFlush;
- }
-
- /**
- * Clean cache after non default stock reindex.
- *
- * @param StockIndexer $subject
- * @param callable $proceed
- * @param array $stockIds
- * @return void
- * @throws \Exception in case product entity type hasn't been initialize.
- * @SuppressWarnings(PHPMD.UnusedFormalParameter)
- */
- public function aroundExecuteList(StockIndexer $subject, callable $proceed, array $stockIds)
- {
- $beforeReindexProductIds = $this->getProductIdsByStockIds->execute($stockIds);
- $proceed($stockIds);
- $afterReindexProductIds = $this->getProductIdsByStockIds->execute($stockIds);
- $productIdsForCacheClean = array_diff($beforeReindexProductIds, $afterReindexProductIds);
- if ($productIdsForCacheClean) {
- $this->flushCacheByProductIds->execute($productIdsForCacheClean);
- }
- }
-}
diff --git a/vendor/magento/module-inventory-cache/Plugin/InventoryIndexer/Indexer/Stock/Strategy/Sync/CacheFlush.php b/vendor/magento/module-inventory-cache/Plugin/InventoryIndexer/Indexer/Stock/Strategy/Sync/CacheFlush.php
new file mode 100644
index 00000000000..e3ae2c8dcdd
--- /dev/null
+++ b/vendor/magento/module-inventory-cache/Plugin/InventoryIndexer/Indexer/Stock/Strategy/Sync/CacheFlush.php
@@ -0,0 +1,61 @@
+flushCacheByProductIds = $flushCacheByProductIds;
+ $this->getProductIdsByStockIds = $getProductIdsForCacheFlush;
+ }
+
+ /**
+ * Clean cache after non default stock reindex.
+ *
+ * @param Sync $subject
+ * @param callable $proceed
+ * @param array $stockIds
+ * @return void
+ * @throws \Exception in case product entity type hasn't been initialize.
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ */
+ public function aroundExecuteList(Sync $subject, callable $proceed, array $stockIds)
+ {
+ $beforeReindexProductIds = $this->getProductIdsByStockIds->execute($stockIds);
+ $proceed($stockIds);
+ $afterReindexProductIds = $this->getProductIdsByStockIds->execute($stockIds);
+ $productIdsForCacheClean = array_diff($beforeReindexProductIds, $afterReindexProductIds);
+ if ($productIdsForCacheClean) {
+ $this->flushCacheByProductIds->execute($productIdsForCacheClean);
+ }
+ }
+}
\ No newline at end of file
diff --git a/vendor/magento/module-inventory-cache/etc/di.xml b/vendor/magento/module-inventory-cache/etc/di.xml
index 0b6c1024f4d..ee6ed202231 100644
--- a/vendor/magento/module-inventory-cache/etc/di.xml
+++ b/vendor/magento/module-inventory-cache/etc/di.xml
@@ -6,20 +6,20 @@
*/
-->
-
-
+
+
-
-
+
+
-
+
- catalog_product_entity
+ Magento\Catalog\Model\Product::CACHE_TAG
-
+
- Magento\Catalog\Model\Product::CACHE_TAG
+ Magento\Catalog\Model\Product::CACHE_PRODUCT_CATEGORY_TAG
-
+
\ No newline at end of file
diff --git a/vendor/magento/module-inventory-catalog/Plugin/InventoryIndexer/Indexer/SourceItem/PriceIndexUpdater.php b/vendor/magento/module-inventory-catalog/Plugin/InventoryIndexer/Indexer/SourceItem/PriceIndexUpdater.php
deleted file mode 100644
index e5c29883ea8..00000000000
--- a/vendor/magento/module-inventory-catalog/Plugin/InventoryIndexer/Indexer/SourceItem/PriceIndexUpdater.php
+++ /dev/null
@@ -1,57 +0,0 @@
-priceIndexProcessor = $priceIndexProcessor;
- $this->productIdsBySourceItemIds = $productIdsBySourceItemIds;
- }
-
- /**
- * @param SourceItemIndexer $subject
- * @param $result
- * @param array $sourceItemIds
- * @SuppressWarnings(PHPMD.UnusedFormalParameter)
- */
- public function afterExecuteList(
- SourceItemIndexer $subject,
- $result,
- array $sourceItemIds
- ): void {
- $productIds = $this->productIdsBySourceItemIds->execute($sourceItemIds);
- if (!empty($productIds)) {
- $this->priceIndexProcessor->reindexList($productIds);
- }
- }
-}
diff --git a/vendor/magento/module-inventory-catalog/Plugin/InventoryIndexer/Indexer/SourceItem/Strategy/Sync/PriceIndexUpdater.php b/vendor/magento/module-inventory-catalog/Plugin/InventoryIndexer/Indexer/SourceItem/Strategy/Sync/PriceIndexUpdater.php
new file mode 100644
index 00000000000..045b90a9af8
--- /dev/null
+++ b/vendor/magento/module-inventory-catalog/Plugin/InventoryIndexer/Indexer/SourceItem/Strategy/Sync/PriceIndexUpdater.php
@@ -0,0 +1,59 @@
+priceIndexProcessor = $priceIndexProcessor;
+ $this->productIdsBySourceItemIds = $productIdsBySourceItemIds;
+ }
+
+ /**
+ * Reindex product prices.
+ *
+ * @param Sync $subject
+ * @param void $result
+ * @param array $sourceItemIds
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ */
+ public function afterExecuteList(
+ Sync $subject,
+ $result,
+ array $sourceItemIds
+ ): void {
+ $productIds = $this->productIdsBySourceItemIds->execute($sourceItemIds);
+ if (!empty($productIds)) {
+ $this->priceIndexProcessor->reindexList($productIds);
+ }
+ }
+}
diff --git a/vendor/magento/module-inventory-catalog/Plugin/InventoryIndexer/Indexer/Stock/Strategy/Sync/PriceIndexUpdatePlugin.php b/vendor/magento/module-inventory-catalog/Plugin/InventoryIndexer/Indexer/Stock/Strategy/Sync/PriceIndexUpdatePlugin.php
new file mode 100644
index 00000000000..4d941117589
--- /dev/null
+++ b/vendor/magento/module-inventory-catalog/Plugin/InventoryIndexer/Indexer/Stock/Strategy/Sync/PriceIndexUpdatePlugin.php
@@ -0,0 +1,57 @@
+getProductIdsByStockIds = $getProductIdsForCacheFlush;
+ $this->priceIndexProcessor = $priceIndexProcessor;
+ }
+
+ /**
+ * Update prices after non default stock reindex.
+ *
+ * @param Sync $subject
+ * @param void $result
+ * @param array $stockIds
+ * @return void
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ */
+ public function afterExecuteList(Sync $subject, $result, array $stockIds)
+ {
+ $productIds = $this->getProductIdsByStockIds->execute($stockIds);
+ if (!empty($productIds)) {
+ $this->priceIndexProcessor->reindexList($productIds);
+ }
+ }
+}
\ No newline at end of file
diff --git a/vendor/magento/module-inventory-catalog/etc/di.xml b/vendor/magento/module-inventory-catalog/etc/di.xml
index 384bb071364..3cb84fcdb7f 100644
--- a/vendor/magento/module-inventory-catalog/etc/di.xml
+++ b/vendor/magento/module-inventory-catalog/etc/di.xml
@@ -20,8 +20,11 @@
-
-
+
+
+
+
+
diff --git a/vendor/magento/module-inventory-indexer/Model/ResourceModel/GetCategoryIdsByProductIds.php b/vendor/magento/module-inventory-indexer/Model/ResourceModel/GetCategoryIdsByProductIds.php
new file mode 100644
index 00000000000..1ea5bf6c091
--- /dev/null
+++ b/vendor/magento/module-inventory-indexer/Model/ResourceModel/GetCategoryIdsByProductIds.php
@@ -0,0 +1,47 @@
+resourceConnection = $resourceConnection;
+ }
+
+ /**
+ * Get category ids for products
+ *
+ * @param array $productIds
+ * @return array
+ */
+ public function execute(array $productIds): array
+ {
+ $connection = $this->resourceConnection->getConnection();
+ $categoryProductTable = $this->resourceConnection->getTableName('catalog_category_product');
+ $select = $connection->select()
+ ->from(['catalog_category_product' => $categoryProductTable], ['category_id'])
+ ->where('product_id IN (?)', $productIds);
+
+ return $connection->fetchCol($select);
+ }
+}
\ No newline at end of file
diff --git a/vendor/magento/module-inventory-indexer/Model/ResourceModel/GetProductIdsByStockIds.php b/vendor/magento/module-inventory-indexer/Model/ResourceModel/GetProductIdsByStockIds.php
new file mode 100644
index 00000000000..e8e3a32cfb9
--- /dev/null
+++ b/vendor/magento/module-inventory-indexer/Model/ResourceModel/GetProductIdsByStockIds.php
@@ -0,0 +1,86 @@
+resource = $resource;
+ $this->defaultStockProvider = $defaultStockProvider;
+ $this->stockIndexTableNameResolver = $stockIndexTableNameResolver;
+ $this->productTableName = $productTableName;
+ }
+
+ /**
+ * Get product ids for given stock form index table.
+ *
+ * @param array $stockIds
+ * @return array
+ */
+ public function execute(array $stockIds): array
+ {
+ $productIds = [[]];
+ foreach ($stockIds as $stockId) {
+ if ($this->defaultStockProvider->getId() === (int)$stockId) {
+ continue;
+ }
+ $stockIndexTableName = $this->stockIndexTableNameResolver->execute($stockId);
+ $connection = $this->resource->getConnection();
+ $sql = $connection->select()
+ ->from(['stock_index' => $stockIndexTableName], [])
+ ->join(
+ ['product' => $this->resource->getTableName($this->productTableName)],
+ 'product.sku = stock_index.' . IndexStructure::SKU,
+ ['product.entity_id']
+ );
+ $productIds[] = $connection->fetchCol($sql);
+ }
+ $productIds = array_merge(...$productIds);
+
+ return array_unique($productIds);
+ }
+}
diff --git a/vendor/magento/module-inventory-indexer/etc/di.xml b/vendor/magento/module-inventory-indexer/etc/di.xml
index dd794617683..e943b67df8b 100644
--- a/vendor/magento/module-inventory-indexer/etc/di.xml
+++ b/vendor/magento/module-inventory-indexer/etc/di.xml
@@ -61,4 +61,9 @@
stock_
+
+
+ catalog_product_entity
+
+