Can Variants be indexed?

I am trying to index Commerce Variants, but they don't seem to be in the collection of Indexable items that are indexed bij Sitecore.

Is there a way to index Variants as well?

  • In reply to Jeroen de Kort:

    Hi

    You can take a look at our reference storefront to see how the CommerceVariants field type is used to configure ProductColor, ProductSize and VariantID to store all variant values on the main product index document.

    The Lucene index configuration file is found here. A similar config file for SOLR is located in the same folder.

    The config file also contains a reference to a custom computed field type VariantInfoComputedField, created specifically for the reference storefront to store both base and list price for all variants on the main product index document.

    The source code for the VariantInfoComputedField is found here

    We have created the PriceSearchResultItem found here as interface for the resulting product commerce item when searching the index

    We are looking up the variant prices from the index in the pipeline processor GetProductBulkPricesFromIndex found here