# Inventory models

An inventory model defines a list of [stock locations](https://docs.commercelayer.io/core-api-reference/stock_locations) ordered by priority. The priority and cutoff determine how the availability of SKUs gets calculated within a market.

{% hint style="info" %}
The stock location cutoff defines the maximum number of stock locations used for inventory computation at the inventory model level. The default value is **2**, it can be increased up to **10** by patching the inventory model resource and setting the desired value for the related attribute.
{% endhint %}

The list of [inventory stock locations](https://docs.commercelayer.io/core-api-reference/inventory_stock_locations) determines the availability of SKUs that are being purchased. The list of [inventory return locations](https://docs.commercelayer.io/core-api-reference/inventory_return_locations) determines the available options for returns.

### Inventory strategies

Multiple [inventory model strategies](https://app.gitbook.com/s/-Lk-ezuDClaMavTqnRi0/inventory/strategies) are available. You can select a specific one by setting the `strategy` attribute accordingly, depending on how you want your order items to be fulfilled. An inventory model strategy is responsible to decide how many [shipments](https://docs.commercelayer.io/core-api-reference/shipments) are generated and from which stock location each shipment will be shipped. Based on the selected strategy, if an order contains line items from two or more stock locations, the order can be split into two or more shipments, one for each location. [Stock transfers](https://docs.commercelayer.io/core-api-reference/stock_transfers) from a stock location (e.g. secondary) to another (e.g. primary) can be created as well.

{% hint style="info" %}
In case the inventory model strategy is left as default – **no split** – just a single shipment from a single stock location is always created.
{% endhint %}

### Stock reservation settings

Draft [stock reservations](https://docs.commercelayer.io/core-api-reference/stock_reservations) (i.e. created before the order placement) have a default expiration date of **1 hour**. You can override the default duration by setting the inventory model `stock_reservation_cutoff` attribute to the desired value (expressed in seconds).

{% hint style="info" %}
Any change to the stock reservations expiration date won't affect existing stock reservations. It will be applied to the ones created after the update only.
{% endhint %}

### Manual stock decrementation

By default as soon as an [order](https://docs.commercelayer.io/core-api-reference/orders) is approved the related [stock item](https://docs.commercelayer.io/core-api-reference/stock_items) quantities are decremented and all the involved [stock reservations](https://docs.commercelayer.io/core-api-reference/stock_reservations) cancelled. If you need to manually manage the stock decrementation and the concomitant stock reservation cancellation at any time after the order approval, you can override this behavior by setting the `manual_stock_decrement` flag to `true`.

{% hint style="info" %}
Please note that the manual stock decrementation does not happen at the order level, but you need to perform it at the [shipment](https://docs.commercelayer.io/core-api-reference/shipments#manual-stock-management) or (if you need more granular control on the action) at the [stock line item level](https://docs.commercelayer.io/core-api-reference/stock_line_items#manual-stock-line-items-management).
{% endhint %}

<details>

<summary>Data model</summary>

Check the related [ER diagram](https://commercelayer.io/docs/data-model/inventory-models) and explore the flowchart that illustrates how the inventory model 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 and how they work.

</details>
