Skip to content

Configure Customer Group Pricing

⏱ 20 minutes intermediate
📜Corecommerce

Not every customer pays the same price. Wholesale buyers expect volume discounts. Partner organizations negotiate custom rates. VIP members earn loyalty pricing. Commerce supports these scenarios through customer groups and segmented price lists, so you can maintain a single catalog while serving different price points to different audiences.

This guide covers creating customer groups, assigning group-specific prices, and configuring quantity-based tier pricing.

  1. Create customer groups for different buyer segments
  2. Assign group-specific prices to variants
  3. Configure quantity-based tier pricing
  4. Verify price resolution for grouped customers

Customer groups define segments of your buyer base. Each group can have its own price list, promotions, and catalog visibility rules.

In the Commerce UI:

  1. Navigate to Commerce > Administration > Customer Groups
  2. Click Add Group
  3. Enter a group name (e.g., “Wholesale”, “Partner”, “VIP”)
  4. Save the group
Create and assign customer groups programmatically
csharp
using Mediachase.Commerce.Customers;

public class CustomerGroupService
{
    public void CreateGroup(string groupName)
    {
        var group = new CustomerGroup
        {
            Name = groupName
        };
        group.SaveChanges();
    }

    public void AssignCustomerToGroup(
        Guid contactId, string groupName)
    {
        var contact = CustomerContext.Current
            .GetContactById(contactId);

        if (contact != null)
        {
            var groups = contact.CustomerGroup != null
                ? new List<string> { contact.CustomerGroup }
                : new List<string>();

            if (!groups.Contains(groupName))
            {
                contact.CustomerGroup = groupName;
                contact.SaveChanges();
            }
        }
    }
}

Each variant can have multiple price entries. The price resolver selects the best match based on the customer’s group, the market, currency, and quantity.

Set group-specific pricing
csharp
using Mediachase.Commerce;
using Mediachase.Commerce.Pricing;

public class GroupPricingService
{
    private readonly IPriceDetailService _priceService;

    public GroupPricingService(
        IPriceDetailService priceService)
    {
        _priceService = priceService;
    }

    public void SetGroupPrices(string variantCode)
    {
        var prices = new List<IPriceDetailValue>
        {
            // Default price for all customers
            new PriceDetailValue
            {
                CatalogKey = new CatalogKey(variantCode),
                MarketId = new MarketId("US"),
                CustomerPricing =
                    CustomerPricing.AllCustomers,
                MinQuantity = 0,
                UnitPrice = new Money(99.99m, Currency.USD),
                ValidFrom = DateTime.UtcNow,
                ValidUntil = null
            },
            // Wholesale group price
            new PriceDetailValue
            {
                CatalogKey = new CatalogKey(variantCode),
                MarketId = new MarketId("US"),
                CustomerPricing = new CustomerPricing(
                    CustomerPricing.PriceType.PriceGroup,
                    "Wholesale"),
                MinQuantity = 0,
                UnitPrice = new Money(69.99m, Currency.USD),
                ValidFrom = DateTime.UtcNow,
                ValidUntil = null
            },
            // VIP group price
            new PriceDetailValue
            {
                CatalogKey = new CatalogKey(variantCode),
                MarketId = new MarketId("US"),
                CustomerPricing = new CustomerPricing(
                    CustomerPricing.PriceType.PriceGroup,
                    "VIP"),
                MinQuantity = 0,
                UnitPrice = new Money(84.99m, Currency.USD),
                ValidFrom = DateTime.UtcNow,
                ValidUntil = null
            }
        };

        _priceService.Save(prices);
    }
}

Tier pricing offers lower unit prices at higher quantities. Combine this with customer groups to create group-specific volume discounts.

Set quantity-based tier pricing
csharp
public void SetTierPricing(string variantCode)
{
    var prices = new List<IPriceDetailValue>
    {
        // 1-9 units: full price
        new PriceDetailValue
        {
            CatalogKey = new CatalogKey(variantCode),
            MarketId = new MarketId("US"),
            CustomerPricing = new CustomerPricing(
                CustomerPricing.PriceType.PriceGroup,
                "Wholesale"),
            MinQuantity = 1,
            UnitPrice = new Money(69.99m, Currency.USD),
            ValidFrom = DateTime.UtcNow
        },
        // 10-49 units: 15% discount
        new PriceDetailValue
        {
            CatalogKey = new CatalogKey(variantCode),
            MarketId = new MarketId("US"),
            CustomerPricing = new CustomerPricing(
                CustomerPricing.PriceType.PriceGroup,
                "Wholesale"),
            MinQuantity = 10,
            UnitPrice = new Money(59.49m, Currency.USD),
            ValidFrom = DateTime.UtcNow
        },
        // 50+ units: 30% discount
        new PriceDetailValue
        {
            CatalogKey = new CatalogKey(variantCode),
            MarketId = new MarketId("US"),
            CustomerPricing = new CustomerPricing(
                CustomerPricing.PriceType.PriceGroup,
                "Wholesale"),
            MinQuantity = 50,
            UnitPrice = new Money(48.99m, Currency.USD),
            ValidFrom = DateTime.UtcNow
        }
    };

    _priceService.Save(prices);
}

Price resolution order: Commerce selects the most specific matching price. A customer in the “Wholesale” group buying 25 units gets the MinQuantity=10 Wholesale price, not the AllCustomers price.

IssueCauseFix
Customer sees default price instead of group priceCustomer not assigned to the groupVerify CustomerGroup property on the contact
Tier pricing not applyingMinQuantity threshold not metCheck that cart quantity meets the minimum for the tier
Group price higher than defaultPrice entries misconfiguredEnsure group-specific prices are lower than AllCustomers prices
Multiple groups conflictingCustomer belongs to multiple segmentsCommerce picks the lowest matching price; verify this is the intended behavior