diff --git a/vendor/magento/module-shared-catalog/Model/ProductManagement.php b/vendor/magento/module-shared-catalog/Model/ProductManagement.php index 24bf11605b..1cd10eb66c 100644 --- a/vendor/magento/module-shared-catalog/Model/ProductManagement.php +++ b/vendor/magento/module-shared-catalog/Model/ProductManagement.php @@ -142,7 +142,6 @@ class ProductManagement implements ProductManagementInterface $categoryIds = $this->sharedCatalogCategoryManagement->getCategories($sharedCatalog->getId()); $productsCategoryIds = $this->getProductsCategoryIds($skus); $assignCategoriesIds = array_diff($productsCategoryIds, $categoryIds); - $this->catalogPermissionManagement->setAllowPermissions($assignCategoriesIds, $customerGroupIds); foreach ($customerGroupIds as $customerGroupId) { $this->sharedCatalogProductItemManagement->addItems($customerGroupId, $skus); @@ -151,9 +150,12 @@ class ProductManagement implements ProductManagementInterface foreach ($products as $product) { if ($product->getId()) { $ids[] = $product->getId(); + } elseif ($product->getSku()) { + $ids[] = $this->productRepository->get($product->getSku())->getId(); } } $this->sharedCatalogInvalidation->reindexCatalogProductPermissions($ids); + $this->catalogPermissionManagement->setAllowPermissions($assignCategoriesIds, $customerGroupIds); return true; } diff --git a/vendor/magento/module-shared-catalog/etc/mview.xml b/vendor/magento/module-shared-catalog/etc/mview.xml index 09afb1e7d8..e1a8e8477b 100644 --- a/vendor/magento/module-shared-catalog/etc/mview.xml +++ b/vendor/magento/module-shared-catalog/etc/mview.xml @@ -11,4 +11,14 @@