Inventory Validator

Validates that all products in the cart have sufficient stock across the relevant warehouses.

Overview

The Inventory Validator is the primary inventory validation mechanism. It checks that each line item in the cart has enough available stock across the relevant warehouses. It supports warehouse resolution from store configuration, shipment-level warehouse assignments, assortment filtering, and configurable order type restrictions.

Identifier

PropertyValue
Connector IDinventoryValidator
Validation TypeInventory
Validation ScopeLineItem

Behavior

  1. Checks if inventory validation is enabled for the cart's order type (see Configuration below)
  2. If the cart has no line items, returns a "Cart is empty" error
  3. Resolves the relevant warehouses:
    • Uses the cart's store and its configured available warehouses
    • Includes warehouses referenced in shipments
    • Falls back to all warehouses if no store is set
  4. Fetches product data and inventory data in parallel
  5. For each line item:
    • Skips virtual products, backorder products, and products in the "service" catalog
    • Skips products where the category has IsInventoryValidationDisabled set to true
    • Skips non-promotion products if IsInventoryValidationDisabledForNonPromotions is enabled
    • Filters inventory by assortment (product StoreIds) unless the order type is in IgnoredOrderTypesForAssortmentInventoryValidator
    • Calculates available quantity: Quantity - ReservedQuantity + CalculatedQuantity (negative values treated as zero)
    • If a shipment has a specific warehouse assigned, only checks that warehouse
    • Tracks cumulative demand per SKU across multiple line items with the same product
  6. Returns a validation error for each line item where the requested quantity exceeds available stock

Error messages

ConditionTranslation Key
Cart has no line itemsCartIsEmpty
Insufficient stock for SKUInventoryValidatorErrorMessage

Configuration

The Inventory Validator supports optional configuration properties in the connector settings.

PropertyTypeDescription
OrderTypesstringComma-separated list of order types to validate. If empty, all order types are validated.

Tenant settings

The following settings from InventoryManagement in tenant settings also affect this validator:

SettingTypeDescription
IsInventoryValidationDisabledForNonPromotionsboolWhen enabled, skips inventory validation for products that are not part of a promotion
IgnoredOrderTypesForAssortmentInventoryValidatorlistOrder types that should skip assortment-based inventory filtering

Example

{
  "name": "inventoryValidator",
  "implementations": ["IValidator"],
  "properties": [
    { "key": "OrderTypes", "value": "Online, B2B" }
  ],
  "disableStandardErrorPolicy": false
}

On this page