Inventory API reference

Inventory Management provides new modules, interfaces, and classes to manage inventory quantities, sources, stocks, etc. This reference details deprecated modules and new services available for managing inventory for single and multi source merchants.

Deprecated modules

Inventory Management deprecates ScalableInventory and CatalogInventory modules.

The ScalableInventory module is part of Magento Commerce. Its original purpose was to perform inventory processing asynchronously, moving the computation of quantities to a worker that processed the calculations later. This functionality was limited in that the asynchronous processing could be performed on backordered products only.

Inventory Management creates reservations for all orders, not just those on backorder. All quantities are calculated asynchronously.

The CatalogInventory module is part of Magento Open Source. Its original purpose was to retrieve and update stock attributes, including status, quantity, and backorders. Inventory Management architecture replaces and expands these capabilities to support multiple stocks and sources, salable quantities, stock quantities, etc.

The following interfaces and classes have been deprecated. They cannot be mapped to new interfaces. The Inventory Management architecture eliminates the need for this functionality.

ScalableInventory interfaces:

  • ItemInterface
  • ItemsInterface

CatalogInventory interfaces:

  • QueryProcessorInterface
  • RegisterProductSaleInterface
  • RevertProductSaleInterface
  • StockCollectionInterface
  • StockConfigurationInterface
  • StockCriteriaInterface
  • StockIndexInterface
  • StockInterface (indexer)
  • StockInterface
  • StockItemCollectionInterface
  • StockItemCriteriaInterface
  • StockItemInterface
  • StockItemRepositoryInterface
  • StockManagementInterface
  • StockRegistryInterface
  • StockRepositoryInterface
  • StockStateInterface
  • StockStatusCollectionInterface
  • StockStatusCriteriaInterface
  • StockStatusInterface
  • StockStatusRepositoryInterface

CatalogInventory classes:

  • Backorders
  • DefaultStock
  • DefaultStockqty
  • Item
  • Minsaleqty
  • Qtyincrements
  • QuantityValidator
  • Status
  • Stock (Helper)
  • Stock (model/source)
  • Stock
  • StockFactory

Inventory Management API

The following services reside under the Magento/InventoryApi/Api namespace, replacing deprecated services and APIs.

Service Description Deprecated API
SourceRepositoryInterface Retrieves, saves or finds (getList method) Source entities -
StockRepositoryInterface Retrieves, saves, finds (getList method) or deletes Stock entities) -
StockSourceLinksSaveInterface Saves sources to stocks assignments -
StockSourceLinksDeleteInterface Removes sources to stocks assignments -
GetStockSourceLinksInterface Retrieves source to stock links according to provided SearchCriteria -
GetSourcesAssignedToStockOrderedByPriorityInterface Retrieves sources assigned to provided stock sorted by priority -
SourceItemRepositoryInterface Finds SourceItems (products assigned to sources with Quantity per Source) by provided SearchCriteria StockItemRepositoryInterface::getList
SourceItemsSaveInterface Saves SourceItems (quantites and stock statuses of products on sources) StockItemRepositoryInterface::save
SourceItemsDeleteInterface Deletes SourceItems (quantites and stock statuses of products on sources) StockItemRepositoryInterface::delete or deleteById

Inventory Catalog API

The following services reside under the Magento/InventoryCatalogApi/Api namespace.

Service Description
DefaultSourceProviderInterface Retrieves Default Source code
DefaultStockProviderInterface Retrieves Default Stock id
BulkInventoryTransferInterface Bulk transfers the whole quantity of products from origin to destination source
BulkPartialInventoryTransferInterface Runs bulk partial inventory transfer for specified items

Inventory Sales API

The following services reside under the Magento/InventorySalesApi/Api namespace, replacing deprecated services and APIs.

Service Description Deprecated API
StockResolverInterface Resolves linked Stock by provided sales channel type and code StockRegistryInterface::getStock
GetStockBySalesChannelInterface Resolves linked stock to provided sales channel object StockRegistryInterface::getStock
IsProductSalableInterface Checks whether product salable StockRegistryInterface::getProductStockStatus
StockRegistryInterface::getProductStockStatusBySku
StockRegistryInterface::getStockStatusBySku
IsProductSalableForRequestedQtyInterface Checks if the product is salable for the requested quantity (used for shopping cart and checkout) StockStateInterface::checkQuoteItemQty
StockStateInterface::checkQty
GetProductSalableQtyInterface Gets product salable quantity (aggregated stock quantity including reservations) StockStateInterface::getStockQty or just retrieve Qty from StockStatus entity
PlaceReservationsForSalesEventInterface Places reservation in the scope some sales event (such as order placement, shipment creation, credit memo creation, order cancelation, etc) RegisterProductSaleInterface
RevertProductSaleInterface

Inventory Configuration API

The following services reside under the Magento/InventoryConfigurationApi/Api namespace, replacing deprecated services and APIs.

Service Description Deprecated API
GetStockItemConfigurationInterface Retrieves stock item configuration by SKU and stock id Catalog inventory configuration stored in StockItem entity
SaveStockItemConfigurationInterface Saves stock item configuration Stock configuration saved using StockItemRepositoryInterface::save

Inventory Source Selection Algorithm (SSA) API

The following services reside under the Magento/InventorySourceSelectionApi/Api namespace.

Service Description
GetDefaultSourceSelectionAlgorithmCodeInterface Gets the default Source Selection Algorithm (SSA) code
GetSourceSelectionAlgorithmListInterface Gets the entire Source Selection Algorithm (SSA) list
SourceSelectionServiceInterface Runs a specified Source Selection Algorithm (SSA) based on provided Inventory Request object

Inventory Export Aggregated Stock Data API

The following services reside under the Magento/InventoryExportStockApi/Api namespace.

Service Description
ExportStockIndexDataInterface Returns salable quantities for a provided sales channel not including placed reservations for completed orders. The quantity amount is less precise and runs with high performance and speed.
ExportStockSalableQtyInterface Returns salable quantities for a provided sales channel including placed reservations (for completed orders). The quantity amount is precise and runs with reduced performance and slower speed.