UpdateInventory

Use the UpdateInventory pipeline component to check the inventory status for an array of stock-keeping units (SKUs) and update the SKU quantities in the Inventory System.

Intended use: Order Processing pipeline, Accept stage.

Configuration Values

None.

Values Read

The UpdateInventory pipeline component reads the following values from the indicated dictionaries.

Key

Dictionary

Description

product_catalog

Order

The name of the product catalog. This weakly typed key is mapped to the strongly typed ProductCatalog property of a LineItem object.

product_id

Order

The product ID. This weakly typed key is mapped to the strongly typed ProductId property of a LineItem object.

product_variant_id

Order

The variant ID. This weakly typed key is mapped to the strongly typed ProductVariantId property of a LineItem object.

quantity

Order

The quantity requested. This weakly typed key is mapped to the strongly typed Quantity property of a LineItem object.

_inventory_allow_backorder_and_preorder

Order

If true, the requested quantity can be backordered and preordered if the in stock quantity cannot meet the request completely. If this value is false and the in stock quantity cannot meet the request, the UpdateInventory component considers the SKU to be out-of-stock and it writes an error to the purchase errors collection. The default is true.

This weakly typed key is mapped to the strongly typed AllowBackordersAndPreorders property of a LineItem object.

CommerceResources

Context

The CommerceResourceCollection that contains all the resources for the site.

MessageManager.pur_out_of_stock

Context

The error message text (optional).

Values Written

The UpdateInventory pipeline component writes the following values to the order form.

Key

Description

_inventory_condition

A value that specifies the current condition of the specified product or variant in the inventory. The values can be BackOrdered, InStock, OutofStock, or PreOrdered.

This weakly typed key is mapped to the strongly typed InventoryCondition property of a LineItem object.

_inventory_in_stock_for_request

The available in-stock quantity to satisfy the request. This weakly typed key is mapped to the strongly typed InStockQuantity property of a LineItem object

_inventory_back_order_for_request

The available back-ordered quantity to satisfy the request. This weakly typed key is mapped to the strongly typed BackorderQuantity property of a LineItem object.

_inventory_pre_order_for_request

The available preorder quantity to satisfy the request. This weakly typed key is mapped to the strongly typed PreorderQuantity property of a LineItem object.

_Purchase_Errors

Error messages are written to this SimpleList object.

Remarks

The UpdateInventory pipeline component writes these values for each line item in the order form unless an out-of-stock condition occurs. If there are multiple line items and one is out of stock, the other items are not processed. If the component cannot update an item because of a database error or an out-of-stock error, the basket process stops, the transaction rolls back, the UpdateInventory pipeline component writes an error to the purchase errors collection, and the return value is a warning.

The UpdateInventory pipeline component updates the inventory values.

See Also

Other Resources

Pipeline Component Reference