Build your own custom StockLevelProvider
  • 23 Feb 2024
  • 1 Minute to read
  • Dark
    Light

Build your own custom StockLevelProvider

  • Dark
    Light

Article summary

Create an apex class that implements the welisacommerce.IStockLevelProvider interface. To configure the new apex class:

  1. Go to Salesforce setup -> Custom Metadata Types -> Plugin Registrations -> 'Manage Records'.
  2. Click 'New' and enter the name of the custom implementation.
  3. Save.
Field labelTypeDescription
LabelTextThe user friendly name of the registration
Plugin Registration NameTextThe technical name of the registration
Class NameTextThe class name of the custom implementation class
PluginReferenceThe specific plugin which the custom class implements

IStockLevel Method signature

GetStockLevelResponse getStockLevels(GetStockLevelRequest request);

GetStockLevelRequest properties

Property nameTypeDescription
productIdsSet(Id)Product2 ids for which the stock level should be retrieved

GetStockLevelResponse properties

Property nameTypeDescription
stockLevelItemsList(StockLevelItem)Stock levels related to the specified product ids in the GetStockLevelRequest

StockLevelItem properties

Property nameTypeDescription
productIdIdThe Product2 id to which the stock level is associated
remainingQuantityDecimalThe remaining stock level amount