The Fulfillment Constraints API enables you to have a higher degree of customization when defining fulfillment and delivery strategies. ## Extension targets The Fulfillment Constraints API exposes the following [targets](/docs/apps/build/app-extensions/configure-app-extensions#targets): | Target | Output type | Description | | ------ | ----------- | ----------- | | `purchase.fulfillment-constraint-rule.run` | [FunctionRunResult](#functionrunresult) | Outputs a list of fulfillment constraints | ## Input The `RunInput` object is the complete schema that your function can receive as [input](/docs/apps/build/functions/input-output#input). For a list of fields that the Fulfillment Constraints API's `Input` object accepts, refer to [Input](/docs/api/functions/reference/fulfillment-constraints/graphql/input). ### Example The following example shows an input query:

The following example shows the resulting input to the query:

## FunctionRunResult The [`FunctionRunResult`](/docs/api/functions/reference//fulfillment-constraints/graphql/functionrunresult) object is the expected [output](/docs/apps/build/functions/input-output#output) for the `purchase.fulfillment-constraint-rule.run` target. ### Example Output objects can return a value of `0` to `n` fulfillment constraints. The following function result specifies that [`DeliverableCartLine`](/docs/api/functions/reference/fulfillment-constraints/graphql/common-objects/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 In scenarios where [`FunctionRunResult`](/docs/api/functions/reference/fulfillment-constraints/graphql/functionrunresult) returns constraints that are mutually exclusive, checkout won't return any shipping rates. ### Scenario 1 In the following example, an item cannot be fulfilled by two locations.

### Scenario 2 In the following example, [`DeliverableCartLine`](/docs/api/functions/reference/fulfillment-constraints/graphql/common-objects/deliverablecartline) `1` and [`DeliverableCartLine`](/docs/api/functions/reference/fulfillment-constraints/graphql/common-objects/deliverablecartline) `2` can't be fulfilled together because they must fulfill from [`Location`](/docs/api/functions/reference/fulfillment-constraints/graphql/common-objects/location) `1` and `2` respectively.