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.
- Create a cart.
- Add an item to the cart that needs to be split.
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:
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
Examples
The item is available in limited quantities at multiple warehouses
Use the split line items endpoint to split and ship items from different locations as in the following example:
Sending individual items in the order to different addresses as gifts
Use the split line items endpoint to split items in the cart and send them to different addresses as in the following example:
Splitting items for promotional bundles or discounts
Use the split line items endpoint to split the items in the cart and item prices will adjust appropriately as in the following example:
Was this page helpful?