@@ -123,7 +123,11 @@ public function buildRecord(DataObject $entity): array
123
123
}
124
124
$ subProducts = $ this ->getSubProducts ($ product );
125
125
$ customData = $ this ->addAdditionalAttributes ($ customData , $ additionalAttributes , $ product , $ subProducts );
126
- $ customData = $ this ->priceManager ->addPriceDataByProductType ($ customData , $ product , $ subProducts );
126
+
127
+ if ($ this ->isPriceIndexingEnabled ($ additionalAttributes )) {
128
+ $ customData = $ this ->priceManager ->addPriceDataByProductType ($ customData , $ product , $ subProducts );
129
+ }
130
+
127
131
$ transport = new DataObject ($ customData );
128
132
$ this ->eventManager ->dispatch (
129
133
'algolia_subproducts_index ' ,
@@ -195,6 +199,15 @@ public function isAttributeEnabled($additionalAttributes, $attributeName): bool
195
199
return false ;
196
200
}
197
201
202
+ /**
203
+ * @param array $additionalAttributes
204
+ * @return bool
205
+ */
206
+ protected function isPriceIndexingEnabled (array $ additionalAttributes ): bool
207
+ {
208
+ return $ this ->isAttributeEnabled ($ additionalAttributes , 'price ' );
209
+ }
210
+
198
211
/**
199
212
* @param array $algoliaData Data for product object to be serialized to Algolia index
200
213
* @param Product $product
@@ -816,3 +829,4 @@ public function productIsInStock($product, $storeId): bool
816
829
return $ product ->isSaleable () && $ stockItem ->getIsInStock ();
817
830
}
818
831
}
832
+
0 commit comments