Split by line items
How to fulfill your orders creating a separate shipment for each line item
Problem
You have an order containing several SKUs, whose stock is available in different locations and — possibly — belongs to multiple shipping categories. You want to create at least a separate shipment per each line item of the order.
![](https://docs.commercelayer.io/~gitbook/image?url=https%3A%2F%2F2610849379-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-Lk-ezuDClaMavTqnRi0%252Fuploads%252F3h5yMQrIrhwkJCd2p3AW%252Fsplit-by-line-items.jpg%3Falt%3Dmedia%26token%3D73933738-e1b8-4728-bef7-31638f716d77&width=768&dpr=4&quality=100&sign=df8f7d24&sv=1)
Solution
You need to use the split by line items strategy. To do that, check the related option in the admin UI or send a PATCH
request to the inventory_models/:id
endpoint, setting the strategy attribute accordingly.
Example
The following request explicitly updates the strategy for the inventory model identified by the "BwAezhyOQw" ID:
This strategy works for line items of type skus
only. If an order contains line items of type bundles
, all the shipments and stock are managed by using the split shipment strategy as a fallback.
How it works
This inventory strategy affects the creation of the resources involved in the process by the following logic.
Shipments
Each line item of the order generates at least a separate shipment, if possible from the primary stock location. In case the primary stock location cannot fulfill the SKUs associated with the line item, one or more shipments are created from the secondary locations.
Stock line items
Each SKU associated with the order generates a stock line item that is also linked to the stock location from which its quantity will be fulfilled.
Shipping categories
In case the order contains SKUs belonging to different shipping categories, this strategy introduces no side effects, since each line item already generates a separate shipment.
Additional notes
Do not ship SKU
If an SKU is marked with the do_not_ship
flag, no shipment is generated for it. The necessary stock line items are created anyway.
This option still tracks inventory.
Do not track SKU
If an SKU is marked with the do_not_track
flag, stock line items are still created but they aren't associated with any stock item so that the stock isn't decremented/incremented on order placement/cancellation.
This option still generates shipments.
More to read
Last updated