This feature in Carts API allows you to add, update, or remove fulfillment information in the cart and associate it with individual items. The cart supports multiple fulfillment options.

Prerequisites

The following prerequisites must be completed sequentially to configure a fulfillment.

  1. Create a cart.
  2. Create a destination address if the fulfillment type is SHIP_TO.
  3. Create an origin address if the fulfillment type is BOPIS or ROPIS.

Fulfillment Initialization

After you create a cart with Create a cart, you will see the fulfillment resource in the cart response.

The following code sample provides the structure of fulfillment object in a cart response:

The fulfillment resource can be associated with an item using the fulfillmentId by making POST request to the {cartId}/fulfillments endpoint.

The following code sample provides how the request is structured in a request payload:

POST Response

The cart has a fulfillment object that stores all the fulfillments added to it.

You can check your fulfillment information by making a GET request to carts/{cartId}/fulfillments/{fulfillmentId} endpoint.

The following code sample provides the structure of fulfillment object in the response:

Examples

Adding a fulfillment with a single cost to multiple items

  1. Create a fulfillment curl.

  2. Create multiple items with same fulfillment using the add items endpoint.

Adding a fulfillment with a custom cost to an item

  1. Create a fulfillment curl.

  2. Add a custom cost to the item using the add item endpoint.

Adding a fulfillment with the type BOPIS or ROPIS requires a locationId

Use the add fulfillment endpoint to add a location when creating a fulfillment as in the following example:

Adding the same destination address to different fulfillments for multiple items

Use the add fulfillment endpoint to create multiple fulfillment with the same addresses as in the following example: