---
title: Multi-market examples
slug: commerce-connect-15/docs/multi-market-examples
docTags: 
createdAt: 2026-07-30T20:34:42.000Z
---

## Display entry listing, prices, and discounts per market

The following examples show how to display catalog entries with pricing and discounts for a selected market.

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/8LW1pCMdm6qqAAyua_8e6_9e3fe3c-changemartket.png)

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/Zku6Fs7khnS1p4cl_pvmF_8d1fb93-changecurrency.png)

## Change the displayed market

The following screenshot shows a storefront market selector that lets users change the active market.

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/PaY-j-ludTb39D3F6_J20_6a540d927b2c30ffb49f72df5c19ae4f5360f0cd5bf3602528ae8fb440c966c2-image.png)

## Get available markets

The following method returns all markets registered in the system:

```csharp
public IEnumerable<IMarket> GetAvailableMarkets() {
  var marketService = ServiceLocator.Current.GetInstance<IMarketService>();
  // Get all available markets.
  return marketService.GetAllMarkets();
}
```

## Get the current market

The following method returns the market associated with the current request:

```csharp
public IMarket GetCurrentMarket() {
  var currentMarketService = ServiceLocator.Current.GetInstance<ICurrentMarket>();
  // Get the current market.
  return currentMarketService.GetCurrentMarket();
}
```

## Set the current market

The following method sets the market for the current request:

```csharp
public void SetCurrentMarket(MarketId marketId) {
  var currentMarketService = ServiceLocator.Current.GetInstance<ICurrentMarket>();
  // Set the current market.
  currentMarketService.SetCurrentMarket(marketId);
}
```

## Get the price for an entry per market

The following method returns the lowest applicable sale price for an entry in the current market:

```csharp
public Price GetSalePrice(Entry entry, decimal quantity) {
  var currentMarketService = ServiceLocator.Current.GetInstance<ICurrentMarket>();
  var currentMarket = currentMarketService.GetCurrentMarket();
  var currency = currentMarket.DefaultCurrency;
  List<CustomerPricing> customerPricing = new List<CustomerPricing>();
  customerPricing.Add(CustomerPricing.AllCustomers);

  var principal = PrincipalInfo.CurrentPrincipal;
  if (principal != null) {
    if (!string.IsNullOrEmpty(principal.Identity.Name)) {
      customerPricing.Add(new CustomerPricing(CustomerPricing.PriceType.UserName, principal.Identity.Name));
    }

    CustomerContact currentUserContact = principal.GetCustomerContact();
    if (currentUserContact != null && !string.IsNullOrEmpty(currentUserContact.EffectiveCustomerGroup)) {
      customerPricing.Add(new CustomerPricing(CustomerPricing.PriceType.PriceGroup, currentUserContact.EffectiveCustomerGroup));
    }
  }

  IPriceService priceService = ServiceLocator.Current.GetInstance<IPriceService>();
  PriceFilter filter = new PriceFilter() {
    Quantity = quantity,
      Currencies = new Currency[] {
        currency
      },
      CustomerPricing = customerPricing
  };

  // Return the lowest price value.
  IPriceValue priceValue = priceService.GetPrices(currentMarket.MarketId, DateTime.UtcNow, new CatalogKey(entry.ID), filter)
    .OrderBy(pv => pv.UnitPrice)
    .FirstOrDefault();

  if (priceValue != null) {
    return new Mediachase.Commerce.Catalog.Objects.Price(priceValue.UnitPrice);
  }

  return null;
}
```

## Get discounts per market

The following method returns the lowest discounted price for a content reference in the current market:

```csharp
public Price GetDiscountPrice(ContentReference contentLink, Currency currency) {
  var currentMarketService = ServiceLocator.Current.GetInstance<ICurrentMarket>();
  var promotionEngine = ServiceLocator.Current.GetInstance<IPromotionEngine>();
  var market = currentMarketService.GetCurrentMarket();
  return promotionEngine.GetDiscountPrices(contentLink, market, currency).First().DiscountPrices.OrderBy(p => p.Price).First().Price;
}
```
