> ## Documentation Index
> Fetch the complete documentation index at: https://developer.fabric.inc/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuring Split Line Items

Splitting line items allows the user to split a single line item into multiple line items based on quantity.

## Prerequisites

The following prerequisites must be completed sequentially to configure splitting line items.

1. [Create a cart](/v3/cart-and-checkout/api-reference/carts-v3/carts/carts).
2. [Add an item to the cart](/v3/cart-and-checkout/api-reference/carts-v3/items/items) that needs to be split.

<Note>The sum of the quantities of the split items must not exceed the total quantity of the line item.</Note>

## Split Line Items Initialization

All information from the original item is copied to the split items except for the item ID, quantity, `createdAt`, and `updatedAt` timestamps. Adjustments, fees, and fulfillment can be copied to split items based on configuration. The default setting is `NONE`, meaning these elements aren't copied to split items unless specified.

The following code sample provides an example for split line items request payload:

<Accordion title="Click to expand the JSON example.">
  ```json theme={null}
      {
          "quantities": [2,1],
          "adjustmentsBehaviour": "COPY",
          "feesBehaviour": "COPY",
          "fulfillmentBehaviour": "COPY"
      }
  ```
</Accordion>

The `quantities` array allows users to specify the number and quantity of split items. The total number of split items is `quantities.size + 1`.\
In this example, a line item with `6` units and `quantities` set to `[2, 1]` splits into `3` items with `quantities [2, 1, 3]`, where the last quantity represents the remainder. With `adjustmentsBehaviour`, `feesBehaviour`, and `fulfillmentBehaviour` set to `COPY`, adjustments, fees, and fulfillment details from the original item are copied to each split item.

The quantities array lets users specify the number and quantity of split items. The total number of split items will be `quantities.size` plus 1.

For example, if a line item has 6 units and quantities is `[2, 1]`, it will be split into 3 items with quantities `[2, 1, 3]`, where the last quantity is the remainder.

The following code sample provides an example for split line items request payload with the `quantities`:

### Split line items request payload

<Accordion title="Click to expand the JSON example.">
  ```json theme={null}
      {
          "quantities": [2,1],
          "adjustmentsBehaviour": "COPY",
          "feesBehaviour": "COPY",
          "fulfillmentBehaviour": "COPY"
      }
  ```
</Accordion>

## Examples

### The item is available in limited quantities at multiple warehouses

Use the [split line items](/v3/cart-and-checkout/api-reference/carts-v3/item-actions/split) endpoint to split and ship items from different locations as in the following example:

<Accordion title="Click to expand the curl example.">
  In this example, 4 units are available in Warehouse A, and the remaining units are in Warehouse B.

  ```curl theme={null}
  curl --location '{{modular_cart_domain}}/carts/9877b7ab-092d-4d67-ad42-b070ac778df8/items/806d6671-801d-4554-976d-0d38e525a852/actions/split' \
  --header 'x-fabric-tenant-id:  {tenantId}' \
  --header 'Content-Type: application/json' \
  --data '{
      "quantities": [4,5],
      "adjustmentsBehaviour": "COPY",
      "feesBehaviour": "COPY",
      "fulfillmentBehaviour": "COPY"
  }'
  ```
</Accordion>

### Sending individual items in the order to different addresses as gifts

Use the [split line items](/v3/cart-and-checkout/api-reference/carts-v3/item-actions/split) endpoint to split items in the cart and send them to different addresses as in the following example:

<Accordion title="Click to expand the curl example.">
  ```curl theme={null}
  curl --location '{{modular_cart_domain}}/carts/9877b7ab-092d-4d67-ad42-b070ac778df8/items/806d6671-801d-4554-976d-0d38e525a852/actions/split' \
  --header 'x-fabric-tenant-id:  {tenantId}' \
  --header 'Content-Type: application/json' \
  --data '{
      "quantities": [4,5],
      "adjustmentsBehaviour": "COPY",
      "feesBehaviour": "COPY",
      "fulfillmentBehaviour": "COPY"
  }'
  ```
</Accordion>

### Splitting items for promotional bundles or discounts

Use the [split line items](/v3/cart-and-checkout/api-reference/carts-v3/item-actions/split) endpoint to split the items in the cart and item prices will adjust appropriately as in the following example:

<Accordion title="Click to expand the curl example.">
  ```curl theme={null}
  curl --location '{{modular_cart_domain}}/carts/9877b7ab-092d-4d67-ad42-b070ac778df8/items/806d6671-801d-4554-976d-0d38e525a852/actions/split' \
  --header 'x-fabric-tenant-id:  {tenantId}' \
  --header 'Content-Type: application/json' \
  --data '{
      "quantities": [4,5],
      "adjustmentsBehaviour": "COPY",
      "feesBehaviour": "COPY",
      "fulfillmentBehaviour": "COPY"
  }'
  ```
</Accordion>
