Model

StockManagement

Magento\CatalogInventory\Model\StockManagement

What it does

This class manages inventory stock operations for product sales in Magento 2.

Developers use it to subtract quantities when orders are placed (registerProductsSale), restore quantities when orders are canceled (revertProductsSale and backItemQty), and handle stock validation.

It ensures proper inventory tracking by managing database locks and coordinating stock item updates across the system.

Public Methods

  • registerProductsSale()
  • revertProductsSale()
  • backItemQty()