diff --git a/packages/Webkul/Product/src/Listeners/ProductFlat.php b/packages/Webkul/Product/src/Listeners/ProductFlat.php index d72085359..bd36e6db8 100644 --- a/packages/Webkul/Product/src/Listeners/ProductFlat.php +++ b/packages/Webkul/Product/src/Listeners/ProductFlat.php @@ -158,9 +158,14 @@ class ProductFlat { static $familyAttributes = []; + static $superAttributes = []; + if (! array_key_exists($product->attribute_family->id, $familyAttributes)) $familyAttributes[$product->attribute_family->id] = $product->attribute_family->custom_attributes; + if ($parentProduct && ! array_key_exists($parentProduct->id, $superAttributes)) + $superAttributes[$parentProduct->id] = $parentProduct->super_attributes()->pluck('code')->toArray(); + foreach (core()->getAllChannels() as $channel) { foreach ($channel->locales as $locale) { $productFlat = $this->productFlatRepository->findOneWhere([ @@ -178,7 +183,7 @@ class ProductFlat } foreach ($familyAttributes[$product->attribute_family->id] as $attribute) { - if ($parentProduct && ! in_array($attribute->code, ['sku', 'name', 'price', 'weight', 'status'])) + if ($parentProduct && ! in_array($attribute->code, array_merge($superAttributes[$parentProduct->id], ['sku', 'name', 'price', 'weight', 'status']))) continue; if (in_array($attribute->code, ['short_description', 'tax_category_id', 'meta_title', 'meta_keywords', 'meta_description', 'width', 'height']))