When using Episerver commerce, if you look at the type definition for the Episerver variant class, you will see a MarketFilter property, however, if you look within the Properties collection on the object you'll also see a property associated with the variant called _ExcludedCatalogEntryMarkets. In today's post, I'm going to cover the differences in these things, what they do and when you might use them.


I've only stumbled across the _ExcludedCatalogEntryMarkets property on a recent project. The project in question used inRiver as a PIM with EpiCommerce. For those of you unfamiliar with inRiver, don't worry too much if you do not get it for this tutorial. The part that you need to understand is that InRIver output some XML which is then imported into Episerver commerce using the commerce Import API.

When products are imported from a third party PIM, you'll want to define what markets the product should be associated with. To do this, instead of defining what markets a product was associated with, you define what markets it should be excluded from. This is based on the markets that you have enabled in EpiCommerce.

What made the situation even more confusing, is that _ExcludedCatalogEntryMarkets is a hidden property, e.g. it's not a property that's defined on the variant base class. If you look within the variant class you won't see it as a public property. If you debug a variant and look in its property collection, which is a key/value pair of all the properties contained on the object you will see it's there. My understanding is that if you want to import products using the import API, then you can use this property to define the markets it shouldn't be applied to. The code to do that is shown below:

MarketFilter is a property that is defined on the Episerver variants base class EntryContentBase. You can use EntryContentBase to define what markets a variant is associated with. If you're unsure about markets, however, you have a need to filter the products your customers see based on some criteria, I suggest you read this for more information on how to do that.

The market filter is the inverse of _ExcludedCatalogEntryMarkets. Where _ExcludedCatalogEntryMarkets defines what markets should be removed during the import. MarketFilter defines the allowed markets. I'm not too sure why there are two items, however, when you debug and see these two properties within the property collection it makes it a bit confusing 😕😕😕

From my experience with commerce markets, the MarketFilter property is assigned from the _ExcludedCatalogEntryMarkets meta field. So if you're having issues with the MarketFilter property not working as you expect it to during an import, it may be worth checking _ExcludedCatalogEntryMarkets as well.

Speaking from first-hand experience, having two properties that are similar in nature can be confusing. Especially as this isn't documented anywhere. The aim of this guide is to try and help you understand the differences between the two market properties that you might see. MarketFilter and _ExcludedCatalogEntryMarkets do similar things, so be warned. Happy Coding 🤘