Area: Optimizely Commerce
Applies to versions: 10 and higher
Other versions:

Excluding Market filter from filter for visitor

Recommended reading 

This topic describes how to exclude a market filter from the "filter for visitor" function in Optimizely Commerce, when using the Optimizely Search & Navigation-Commerce (EPiServer.Find.Commerce) integration.

How it works

By default, when installing EPiServer.Find.Commerce, EntryContentBase types do not get hits in the Search & Navigation index until all documents are reindexed. To override this functionality, follow this step.

In the templates, inside the InitializationModule class, re-register all instances that implement the IFilterForVisitor interface, except for an instance of FilterCurrentMarketForVisitor.

public void ConfigureContainer(ServiceConfigurationContext context)
    context.Services.Configure(c => c.For<ICurrentMarket>().Singleton().Use<MarketStorage>());

private void SetupFilterForVisitor(ServiceConfigurationContext context)
    var customFilterForVisitors = context.Container.GetAllInstances<IFilterForVisitor>().Where(x => !(x is FilterCurrentMarketForVisitor));
    foreach (var instance in customFilterForVisitors)


Do you find this information helpful? Please log in to provide feedback.

Last updated: Oct 24, 2016

Recommended reading