The Java code you write determines the order flow and customer experience by calling Inventory API methods in a particular order. Most sites use a ‘shopping cart’ system that allows a user to shop with the aid of an inventory manager in a way that’s similar to a brick-and-mortar store’s experience.
For example, after the customer checks out a shopping cart and enters the shipping and payment information, the rest of the order system (including fulfillment) uses the Inventory API.
The purchase call is made on each of the items in the shopping cart. If there is enough stock in the inventory to fulfill the order, the purchase call succeeds. If the purchase call does not succeed, the availability status of the item can be queried to determine if the item is preorderable, backorderable, or out of stock. Depending on the availability status, the item can be backordered or preordered. The fulfillment system makes this determination.
Note: Your sites can also be set up so that as the customer browses items, the inventory system can be queried for item availability.
If an item is purchased successfully, its stocklevel
is decreased. If the item is backordered, the backorderLevel
is decreased. If the item is preordered, the preorderLevel
is decreased.
The store administrator uses setStocklevel
, increaseStocklevel
, and decreaseStocklevel
to manage the inventory levels in the store. The store administrator uses setBackorderLevel
, increaseBackorderLevel
, and decreaseBackorderLevel
to manage the backorderable amount. The store administrator uses setPreorderLevel
, increasePreorderLevel
, and decreasePreorderLevel
for preorderable items. The administrator can get information on each of these levels with queryStocklevel
, queryBackorderLevel
, and queryPreorderLevel
.
Each of these levels (stocklevel
, backorderLevel
, and preorderLevel
) has a threshold associated with it. If the level falls below its associated threshold, an InventoryThresholdReached
event is generated. There are methods in the API for the administrator to set each of these thresholds.
Two methods can be used to purchase items that were previously backordered or previously preordered. These are purchaseOffBackorder
and purchaseOffPreorder
. See the section on RepositoryInventoryManager for further discussion of these methods.