For each SKU in the Commerce Reference Store catalog, there is a corresponding inventory
item in the inventory repository that tracks inventory data for the SKU. Commerce includes a mechanism for tracking the current availability of a SKU using the inventory
item’s availabilityStatus
property. This property can be set to integers that represent IN_STOCK (1000), OUT_OF_STOCK (1001), PREORDERABLE (1002), BACKORDERABLE (1003), DERIVED (1004), and DISCONTINUED (1005).
In the Commerce Reference Store inventory repository, every inventory
item’s availabilityStatus
property is set to 1004 (DERIVED). This means that rather than having an explicit value, the status is derived at runtime based on the values of three other inventory
item properties: stockLevel
, backorderLevel
, and preorderLevel
. The logic for deriving the status value is:
If
stockLevel
is not 0, the SKU is in stock.If
stockLevel
is 0 butbackorderLevel
is not 0, the SKU is backorderable.If
stockLevel
andbackorderLevel
are both 0, butpreorderLevel
is not 0, then the SKU is preorderable.If all three values are 0, the SKU is out of stock.
For most Commerce Reference Store SKUs, the values of these properties are all null, which means they use the default values set in the InventoryManager.properties
file:
# These are the values used for the respective levels, if there # is no value defined in the repository. Remember, -1 implies an # infinite amount. # defaultStockLevel=-1 defaultBackorderLevel=0 defaultPreorderLevel=0