Order Utils
Essential knowledgeCore knowledge to understand Fluent Commerce
Intended Audience:
Technical User
Authors:
Holger Lierse, Kirill Gaiduk
Changed on:
13 Aug 2026
Overview
The`OrderUtils` class in the `util-sourcing` is a utility class that provides order-specific utilities for sourcing operations. It handles order-related sourcing operations including fulfillment creation, fulfillment type determination, and order item management.Key points
- Order-Specific Operations: Handles order-related sourcing operations
- Fulfillment Creation: Creates fulfillment records based on sourcing plans
- Fulfillment Type Management: Sets fulfillment types based on business rules
- Order Item Management: Manages order items and their allocation to fulfillments
Core Methods
`createFulfilments()`
Creates fulfillments from a `SourcingPlan`, allocating order items to locations and assigning fulfillment types. - Each
`FulfilmentItem`includes an`availableQty`field that records the available quantity at the sourcing location at the time of plan generation - Fulfillment
`refs`are assigned deterministically (`{orderId}-{fulfilmentChoiceId}-{index}`) - derived from the`SourcingContext`Id (e.g., order Id), fulfillment choice Id, and a consecutive index starting from the number of already existing fulfillments. This ensures that two sourcing processes running concurrently for the same fulfillments produce identical refs, preventing duplicate fulfillment creation