SKUs

The SKU object and the allowed CRUD operations on the related resource endpoint

SKUs describe specific product variations that are being sold. A unique code identifies each SKU, which can be either the EAN code, the UPC, or any other code format.

The SKU name, description, and image_url are best suited for internal usage (Commerce Layer is not a CMS).

By marking an SKU with the do_not_ship and do_not_track combinable flags, is possible to manage different scenarios, such as intangible products which generate no shipments, or products with a virtually infinite stock.

When creating an SKU you need to specify its shipping category, unless the SKU is marked as do_not_ship, in which case the relationship with the shipping category is optional.

Inventory information

For performance reasons the inventory attribute is returned when retrieving a single SKU only.

The related aggregated information about the SKU's inventory considers the active markets in scope only.

FieldTypeDescription

inventory.available

boolean

The SKU availability, based on the stock items associated with the stock location in scope — true if the sum of all the stock item quantities is greater than zero or if the SKU is marked as do_not_track.

inventory.quantity

integer

The sum of the SKU's stock item quantities in the stock locations in scope (net of the related reserved stock quantities).

inventory.levels

array

Aggregated information by stock location, including stock item quantity and available delivery lead times (ordered by shipping method cost, ascending).

Checking real-time stock availability

You can fetch via API a list of SKUs and include the stock_items.reserved_stock relationships, but in order to get the real-time stock availability you need to perform some additional computation on your side, based on the response payload:

  1. Cycle the included payload for each SKU to get the sums of stock_items and reserved_stocks quantities.

  2. Subtract the latter from the former to get the cross-stock availability for each SKU (you can also do distinct subtractions to get the per-stock SKU availability).

Data model

Check the related ER diagram and explore the flowchart that illustrates how the SKU resource relates to the other API entities.

Last updated