# Stock line items

Stock line items track the [SKUs](https://docs.commercelayer.io/core-api-reference/skus) in an order's [shipment](https://docs.commercelayer.io/core-api-reference/shipments).

If you rely on one of the [available strategies](https://app.gitbook.com/s/-Lk-ezuDClaMavTqnRi0/inventory/strategies), the stock line items creation and management is automatic:

* If an order is not split, the stock line items correspond to all the SKUs in the order.
* If the order is split, the line items are split into more than one shipment. A single line item can also be split into more than one stock line item.

## Manual stock line items management

You can always create new stock items and modify or update existing ones (using [integration](https://app.gitbook.com/s/-LgByaSP8eKjad-MIuHE/api-credentials#integration) API credentials), as long as the stock item quantity you choose is available for the involved product in one of the inventory stock locations belonging to the inventory model associated with the related order's market. Since the relationship with the line item is optional when creating a stock line item, you're free to create a stock line item associated with a shipment that involves a product that originally wasn't part of the order (e.g. sending an additional product as a free gift, replacing an unavailable product with another one, etc.). When you delete an existing stock line item the related stock reservation is removed and the corresponding stock is automatically released.

{% hint style="info" %}
The available quantity validation is performed only if the stock line item is associated with a stock item (e.g. you can choose to add as free gift a `do_not_track` [SKU](https://docs.commercelayer.io/core-api-reference/skus) with no constraint on the stock).
{% endhint %}

{% hint style="warning" %}
When you manually manage stock line items, make sure to consistently update the related stock. To do that, you can leverage [some specific trigger attributes](https://docs.commercelayer.io/core-api-reference/shipments#manual-stock-management) exposed at the shipment level or (if you need more granular control on the process) on each single stock line item.
{% endhint %}

<details>

<summary>Data model</summary>

Check the related [ER diagram](https://commercelayer.io/docs/data-model/shipments-and-shipping-categories) and explore the flowchart that illustrates how the stock line item resource relates to the other API entities.

</details>

<details>

<summary>How-to</summary>

Check the related [guide](https://app.gitbook.com/s/-Lk-ezuDClaMavTqnRi0/inventory/strategies) to learn more about the available inventory model strategies, how they work, and how stock line items are managed based on each of them.

</details>
