Fulfillment Constraints API reference
The Fulfillment Constraints API enables you to have a higher degree of customization when defining fulfillment and delivery strategies.
Extension targets
Anchor link to section titled "Extension targets"The Fulfillment Constraints API exposes the following targets:
Target | Output type | Description |
---|---|---|
purchase.fulfillment-constraint-rule.run |
FunctionRunResult | Outputs a list of fulfillment constraints |
The RunInput
object is the complete schema that your function can receive as input.
For a list of fields that the Fulfillment Constraints API's Input
object accepts, refer to Input.
The following example shows an input query:
The following example shows the resulting input to the query:
FunctionRunResult
Anchor link to section titled "FunctionRunResult"The FunctionRunResult
object is the expected output for the purchase.fulfillment-constraint-rule.run
target.
Output objects can return a value of 0
to n
fulfillment constraints. The following function result specifies that DeliverableCartLine
1
and 2
must ship or fulfill from same location, and lines 3
and 4
must ship or fulfill from locations 1
or 2
:
Optionally, the deliverableLineIds
key can be omitted from the constraint operation to indicate that the fulfillment constraint should be applied to all deliverable lines within the cart.
Functions conflict
Anchor link to section titled "Functions conflict"In scenarios where FunctionRunResult
returns constraints that are mutually exclusive, checkout won't return any shipping rates.
In the following example, an item cannot be fulfilled by two locations.
In the following example, DeliverableCartLine
1
and DeliverableCartLine
2
can't be fulfilled together because they must fulfill from Location
1
and 2
respectively.