Working with Buffers

Overwiew 

Purpose of Buffers: Buffers are used to reserve a certain number of stock units. Their primary role is to prevent issues like stock desynchronization across various sales channels. This is particularly useful in scenarios where there are both physical store sales and online sales.

Application by Stock Type: Buffers can be applied in different ways, either globally or by specific endpoints (like a particular store or warehouse). The key aspect of buffer application is that it is always open by stock type. This means each type of stock, like on_hand or ASN (Advanced Shipping Notice), is considered separately, and buffers for different stock types are not unified.

Types of Buffers

There are two types of buffers, detailed buffers and global buffers. The first will be assigned and deducted at endpoint level, the second will be assigned without a notion of endpoint and will be deducted once the stock locations have been aggregated. As a result, the global buffers are only taken into account in the stock query with unification by stock llocation.

Detailed Buffer

Declaration by item, stock location ID pair (BufPairs)

The simplest buffers, corresponding to a number of buffered units for a couple item_id , endpoint_id.

Stock Location ID

Item ID

Quantity

Buffer group

Stock Location ID

Item ID

Quantity

Buffer group

store_1

i1

2

FR

store_1

i1

3

US

Declaration by key requests (BufKeyRequest)

Similar to previous, but more flexible. Allows to apply the buffer based on an existing Item and Stock Location Key Request. Key requests are prefilled Item queries, which allow for example retrieveing items from Spring Season, or Stock Locations from London

Stock Locations

Items

Quantity

Buffer group

Stock Locations

Items

Quantity

Buffer group

London stores

Spring 25

3

UK

Paris stores

Spring 25

2

FR

Global Buffer (BufGlob)

Allows a buffer to be allocated globally, i.e. without filtering the stock locations affected. If an endpoint filter is declared, it will be ignored. Allows a number of units to be buffered globally.

Items

Quantity

Buffer group

Global

Items

Quantity

Buffer group

Global

Spring 25

15

UK

true

Spring 25

10

FR

true

Creating buffers

Buffers can be created by API. Refere to our API documentation portal for more information : API Portal - OneStock

Impact of buffers on stock calculations

Taken into account in stock requests

Buffers are categorized into buffer groups. This categorization allows for efficient referencing from a stock query, making the management of buffers more structured and organized.

Bufferes are taken into account in Stock Queries when their groups are referenced in the query.

Global buffers will only take effect when the Stock Query is unified by stock location, otherwise it will not be taken into account.

Learn more about stock queries herer Configuration of stock queries

Calculation

The rule of thumb for buffer application is that the biggest buffer possible will be applied. When unifing stock, global buffers will only be applied if their impact is greater than the one of detailed buffers. If multiple buffers are configured at a given level (detailed or global) the greatest indidual one among them will be applied.

When buffers are taken into account in a stock request, available stock is calculated as follows: 

Legend

BufPairs = Detailed Buffer - Declaration by item, stock location ID pair

BufKeyRequest = Detailed Buffer - Declaration by key requests

BufGlob = Global Buffer

Detailed stock query (Without stock location unification)

Stock per stock location : MAX( RawStock - ResStockLocation - Dispositions - MAX(BufPairs, BufKeyRequest) , 0 )

Unified stock query (With stock location unification)

MIN(     SUM(         MAX_per_stock_location(             RawStock - ResStockLocation - Dispositions - MAX(BufPairs, BufKeyRequest),             0         )     ),     SUM(RawStock - ResStockLocation- Dispositions) - BufGlob )

Example

Consider a product with 10 units of stock per stock location, distributed through three different stock locations. Let's say each location has a buffer of 4 units configured. Normally, a buffer of 4 units would be applied individually to each location. However, if one location only has 2 units in stock, the application of the buffer for that location would be reduced to 2 units to prevent negative stock. The other locations would retain their 4-unit buffer.

Now, if a global buffer of 11 units is applied during stock unification:

  • In the first scenario (where each location has a buffer of 4 units), the global buffer of 11 units would not be applied, as the total of individual buffers (4+4+4 = 12) exceeds the global buffer.

  • In the second scenario (with buffers of 2, 4, and 4 units), the global buffer would apply because the total of individual buffers (2+4+4 = 10) is less than the global buffer.