Fluent Commerce Logo
Docs

Sourcing Conditions Overview

Essential knowledge

Intended Audience:

Technical User

Author:

Kirill Gaiduk

Changed on:

2 Oct 2025

Overview

Sourcing Conditions let you control how Sourcing Strategies are applied within the Responsive Sourcing Framework. After reading, you will understand how to configure and extend them to adapt sourcing logic for specific Sourcing Requests.

Key points

  • Define your sourcing logic with configurable Sourcing Conditions that evaluate Sourcing Requests and return true/false outcomes
  • Reference Sourcing Conditions schema is global but can be extended or overridden with customer-specific definitions for tailored Strategies
  • Condition Utilities provide reference function, default operators (equality, comparison, membership, existence), and support custom extensions
  • All Conditions should be configured with clear naming and parameters to ensure accurate and predictable evaluation

What is a Sourcing Condition?

A Sourcing Condition is a function that returns a boolean value (`true` or `false`) based on the evaluation of the Sourcing Context. It determines whether a Primary or Fallback Sourcing Strategy applies to a specific Sourcing Request, such as:

  • Order
  • Fulfillment Choice
  • Fulfillment Option

Architectural Context

Sourcing Conditions are part of the Responsive Sourcing Framework within the Fluent platform. They sit in several places within the platform, each serving a distinct role:

1. Sourcing Condition Entity

Sourcing Condition Entity is represented by the `SourcingCondition` GraphQL type.

It refers to an individual, concrete instance of a Sourcing Condition that is configured as part of a Sourcing Strategy.

Structure

Field

Type

Description

Notes

`name`

`String`

Name of the Sourcing Condition

The `name` serves as a unique identifier for Sourcing Conditions

Reference Sourcing Conditions schema (specified in the `fc.rubix.order.sourcing.conditions` Setting) can be overridden by using the same `name` and alternative configuration in the `fc.rubix.order.sourcing.conditions.custom` Setting

`type`

`String`

Type of the Sourcing Condition

The `type` is mapped to a specific function in the `util-sourcing` library (Condition Utilities)

`params`

`Json`

Parameters of the Sourcing Condition

The Parameters configure Sourcing Conditions to support specific customer sourcing logic

Available configuration options are defined with the `fc.rubix.order.sourcing.conditions` and `fc.rubix.order.sourcing.conditions.custom` Settings

2. Sourcing Conditions Schema

The Sourcing Conditions schema is located in the dedicated Setting(s):

  • `fc.rubix.order.sourcing.conditions` stores reference (`GLOBAL`) Sourcing Conditions schema
  • `fc.rubix.order.sourcing.conditions.custom` can be created for customer-specific (`ACCOUNT` / `RETAILER`) Sourcing Conditions schema

It defines the structure of a Condition and specifies which parameters it can include. In practice, it acts as the template for a Sourcing Condition that is added to the Conditions library, making it available for configuration and use by end users.

3. Condition Utilities

Condition Utilities are an integral part of the Sourcing Utilities bundle.

They include:

  • Reference Condition Function (`DefaultSourcingCondition`)
    • This class evaluates a Sourcing Condition using three key parameters:
      • `path` – identifies the value(s) within the Sourcing Context (for example, Order creation date, Delivery country, Customer tier, or Product category)
      • `operator` – defines how the values are compared
      • `value` – the target value or array of values specified in the Condition `params`
    • The function checks whether the values retrieved from the Sourcing Context (via the JSON path) meet the criteria defined by the operator and `params` values
    • The outcome of this check determines whether the Condition is satisfied
  • Operator Utilities
    • Include reference operators (equality, comparison, set membership, existence checks)
    • Support custom operators registration (via `SourcingConditionOperatorRegistry`)
    • Provide common validation and value-conversion logic (`AbstractSourcingConditionOperator`)
  • Helper Methods (`SourcingConditionUtils`)
    • Evaluate a list of Conditions against a Sourcing Context
    • Return:
      • `true` if all Conditions pass or list is empty / `null`
      • `false` if at least one Condition fails
  • Custom Condition Registry (`SourcingConditionTypeRegistry`)
    • Registers and retrieves Condition types by identifiers
    • Dynamically instantiates Condition implementations during Strategy evaluation

Features

Within the Responsive Sourcing Framework, Sourcing Conditions provide the ability to:

  • Adapt sourcing logic to specific business needs by configuring different Sourcing Strategies and controlling their application based on the characteristics of a Sourcing Request
  • Leverage the reference library of predefined Sourcing Conditions, along with extensive configuration and customization options
  • Develop new Sourcing Conditions using recommended patterns and best practices to extend sourcing logic as needed