HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In
GitHubNuGetDev CommunityDoc feedback

## Index the entire variant inside the product

By default, variants are indexed as ContentReferences inside the product document sent to the Optimizely Search & Navigation index. This allows all variant references for a specific product from the index and gets the product for a specific variant.

Depending on how your site works, it might be better to index the entire variant inside of the product_,_ as shown in the following examples.

### Override CatalogContentClientConventions


Override the CatalogContentClientConventions class, and register it in an initialization module to override the default conventions.

### Exclude variant reference indexing for product content

To exclude variant references, override the ApplyProductContentConventions, and exclude the field using conventions.

### Include related variant content items in product content

Create a new extension method for product content to be able to index variants for it.

### Add default price and prices in product content

The following example shows how to

  • index the highest default price for product variants

  • index prices from variants in the Prices extension method

### Add inventory in product content

The following example shows how to index the inventories from variants.

### Exclude indexing of variant content

Exclude the variant content from being indexed by calling ShouldIndex for the type, using the conventions API.

### Listen for price and inventory changes

The CatalogContentEventListener class listens for price changes for classes that implement IPricing, and inventories for classes that implement IStockPlacement. VariationContent implements both of them, but ProductContent does not implement them. Therefore, override the default implementation and make some changes.