Model

StockState

Magento\CatalogInventory\Model\StockState

What it does

This class serves as a facade for checking product stock availability and quantities in Magento 2.

Developers use it to verify if products are in stock, validate requested quantities against inventory rules (min/max qty, increments), and get current stock levels.

It's commonly used during add-to-cart operations, checkout processes, and inventory validation workflows.

Public Methods

  • verifyStock()
  • verifyNotification()
  • checkQty()
  • suggestQty()
  • getStockQty()
  • checkQtyIncrements()
  • checkQuoteItemQty()