For developers: Inventory of products
The inventory of a product represents its available quantity in the store. You can configure the Ecommerce module to track the available quantity and to perform an action after a product has been sold out. For more information, see Inventory.
You can manage the inventory through the following properties of the Product class:
- Inventory
Gets or sets the available quantity for a product.
- TrackInventory
Specifies whether the Ecommerce module tracks the inventory and perform an action after a product has been sold out. When tracking the inventory of a product, the For developers: IEcommerceProductInventoryChanged event is fired every time when the quantity of the product changes. The enumeration has the following values:
- DonotTrack
Specifies not to track the inventory for the product.
- Track
Specifies to track the inventory of the product.
- TrackByVariations
Specifies to track the inventories of the product’s variations. In this case, the Ecommerce module tracks the values of the inventory properties of the variations of the product. For more information, see For developers: Inventory of variations.
- OutOfStockOption
Specifies the action that the system performs when a product has been sold. The enumeration has the following values:
- DisplayAndAllowOrders
The product is displayed on the frontend and customers can order it.
- DisplayButDontAllowOrders
The product is displayed on the frontend, but customers cannot order it.
- DoNotDisplayTheProduct
The product is not displayed on the frontend.
Enable inventory tracking
To enable tracking, you must modify the product and set its TrackInventory property to TrackInventory.Track. For more information, see For developers: Modify products.
Enable the inventory tracking of a product
Disable inventory tracking
To disable tracking, you must modify the product and set its TrackInventory property to TrackInventory.DonotTrack. For more information, see For developers: Modify products.
Disable the inventory tracking of a product
Update the inventory
To update the available quantity of a product, you must modify the product and set its Inventory property to the desired value. For more information, see For developers: Modify products.
Update the inventory of a product