Customer Categories

Customer-specific product visibility through category restrictions

Customer categories allow you to control which products specific customers can see. This is particularly useful for B2B scenarios where different customers or customer segments should have access to different product catalogs.


Overview

Customers can have two types of category restrictions:

PropertyTypeDescription
assortmentIncludeProductCategoryIdsList<string>Categories the customer can see
assortmentExcludeProductCategoryIdsList<string>Categories the customer cannot see

When a customer searches for products:

  • If they have include categories, only products in those categories are shown
  • Exclude categories are always filtered out, regardless of include settings

How It Works

Product Search with CustomerId


┌───────────────────────────────────────────────────────────────┐
│  Load Customer                                                 │
│  ├── AssortmentIncludeProductCategoryIds: ["electronics"]     │
│  └── AssortmentExcludeProductCategoryIds: ["restricted"]      │
└───────────────────────────────────────────────────────────────┘


┌───────────────────────────────────────────────────────────────┐
│  Apply Category Filter                                         │
│  ├── Include: Only show products in "electronics" category    │
│  └── Exclude: Hide products in "restricted" category          │
└───────────────────────────────────────────────────────────────┘


    Filtered Results

Customer Configuration

Business Customer

{
  "customerId": "acme-corp",
  "customerType": "business",
  "name": "ACME Corporation",
  "assortmentIncludeProductCategoryIds": [
    "industrial-equipment",
    "safety-gear"
  ],
  "assortmentExcludeProductCategoryIds": [
    "consumer-products"
  ]
}

Private Customer

{
  "customerId": "john-doe",
  "customerType": "private",
  "name": "John Doe",
  "assortmentIncludeProductCategoryIds": ["vip-products"],
  "assortmentExcludeProductCategoryIds": []
}

API Operations

Set Customer Categories

PATCH /api/BusinessCustomers/PatchBusinessCustomer
Content-Type: application/json
 
{
  "customerId": "acme-corp",
  "assortmentIncludeCategoryIds": ["industrial-equipment", "safety-gear"],
  "assortmentExcludeCategoryIds": ["consumer-products"]
}

Or for private customers:

PATCH /api/PrivateCustomers/PatchPrivateCustomer
Content-Type: application/json
 
{
  "customerId": "john-doe",
  "assortmentIncludeCategoryIds": ["vip-products"],
  "assortmentExcludeCategoryIds": []
}

The customerId must be included in the request body, not as a URL parameter.

Remove Category Restrictions

Send an empty array to remove restrictions:

PATCH /api/BusinessCustomers/PatchBusinessCustomer
Content-Type: application/json
 
{
  "customerId": "acme-corp",
  "assortmentIncludeCategoryIds": [],
  "assortmentExcludeCategoryIds": []
}

Sending null does not update the property. To remove categories, you must send an empty array [].


Search Behavior

With Include Categories

When a customer has assortmentIncludeProductCategoryIds:

POST /api/Products/Search
{
  "customerId": "acme-corp",
  "query": "equipment"
}

The search automatically filters to show only products in the customer's allowed categories.

Ignoring Customer Assortment

To bypass customer category restrictions (e.g., for admin views):

POST /api/Products/Search
{
  "customerId": "acme-corp",
  "ignoreCustomerAssortment": true,
  "query": "equipment"
}

User-Specified Categories

If the user specifies categories in the search request:

ScenarioBehavior
User provides categories, customer has includeUser's categories are used
User provides no categories, customer has includeCustomer's include categories are applied
Customer has exclude categoriesAlways applied (cannot be overridden)

How Filtering Works

When a product search includes a customerId:

  1. The customer is loaded from the database
  2. If the search request has no category filter AND the customer has include categories:
    • The customer's include categories become the search filter
  3. If the customer has exclude categories:
    • These are always applied (cannot be overridden by the search request)

This ensures customers only see products they're authorized to view.


Use Cases

B2B Customer Tiers

Different customers see different product ranges:

Bronze Tier Customer:

{
  "assortmentIncludeProductCategoryIds": ["basic-products"]
}

Gold Tier Customer:

{
  "assortmentIncludeProductCategoryIds": [
    "basic-products",
    "premium-products",
    "exclusive-products"
  ]
}

Industry-Specific Catalogs

Customers in different industries see relevant products:

Healthcare Customer:

{
  "assortmentIncludeProductCategoryIds": [
    "medical-equipment",
    "sanitization",
    "safety-gear"
  ]
}

Manufacturing Customer:

{
  "assortmentIncludeProductCategoryIds": [
    "industrial-machinery",
    "raw-materials",
    "safety-gear"
  ]
}

Restricted Products

Hide certain products from specific customers:

Standard Customer:

{
  "assortmentExcludeProductCategoryIds": [
    "restricted",
    "hazardous",
    "licensed-only"
  ]
}

Combining with Other Assortment Controls

Customer categories work alongside other assortment mechanisms:

ControlRelationship
Store/Market IDsApplied first (AND logic)
Assortment CodesApplied separately (AND logic)
Customer CategoriesApplied on search (AND logic)
IsActive/DatesApplied on search (AND logic)

Example: A product must:

  1. Be in the customer's allowed categories
  2. AND be in the current store's assortment
  3. AND have matching assortment codes (if customer is restricted)
  4. AND be active with valid dates

Best Practices

Category Granularity

Design categories with customer restrictions in mind:

  • Create clear separation between restricted and unrestricted categories
  • Use parent categories for broad restrictions
  • Use child categories for fine-grained control

Testing Customer Views

To test what a customer sees:

  1. Create a test search request with the customer's ID
  2. Compare results with and without ignoreCustomerAssortment
  3. Verify expected products are visible/hidden

Bulk Customer Updates

When updating many customers with the same restrictions, consider:

  • Creating a customer group with default category settings
  • Using API bulk operations
  • Importing category assignments via data integration

Troubleshooting

ProblemCauseSolution
Customer sees no productsInclude categories don't match any productsVerify category IDs exist and products have them
Customer sees restricted productsExclude categories not setAdd categories to assortmentExcludeCategoryIds
Categories not applyingignoreCustomerAssortment is trueRemove flag from search request
Wrong customer typeLooking up business vs privateVerify customer type and use correct service
Categories not updatingSent null instead of empty arrayUse [] to clear, null preserves existing