--- title: "StocklevelProvider" slug: "stocklevelprovider" updated: 2024-11-26T11:15:13Z published: 2024-11-26T11:15:13Z canonical: "support.ordercentral.io/stocklevelprovider" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.ordercentral.io/llms.txt > Use this file to discover all available pages before exploring further. # StocklevelProvider **IStockLevelProvider Method signature** ```plaintext GetStockLevelResponse getStockLevels(GetStockLevelRequest request); ``` **GetStockLevelRequest properties** | **Property name** | **Type** | **Description** | | --- | --- | --- | | productIds | Set(Id) | Product2 ids for which the stock level should be retrieved | | stockItems | List | A list of StockItem objects containing product (same as in the productIds property) and pricebook IDs. | **GetStockLevelRequest.StockItem properties** | Name | Type | Description | | --- | --- | --- | | productId | Id | The Product2 Id of a product to retrieve the stock for | | pricebookId | Id | The Pricebook2 Id which is used to determine the price for the account of the buyer. | **GetStockLevelResponse properties** | **Property name** | **Type** | **Description** | | --- | --- | --- | | stockLevelItems | List(StockLevelItem) | Stock levels related to the specified product ids in the GetStockLevelRequest | **StockLevelItem properties** | **Property name** | **Type** | **Description** | | --- | --- | --- | | productId | Id | The Product2 id to which the stock level is associated | | remainingQuantity | Decimal | The remaining stock level amount | | minimalQuantity | Decimal | Specify to override the default minimal stock level entered on a Web Product or in the global settings | ### Example implementation ```java public class CustomStockLevelProvider implements welisacommerce.IStockLevelProvider {    public welisacommerce.GetStockLevelResponse getStockLevels(welisacommerce.GetStockLevelRequest request) {        // Create a response object        welisacommerce.GetStockLevelResponse response = new welisacommerce.GetStockLevelResponse();        response.stockLevelItems = new List();        // Iterate over the request's stock items and populate stock levels        for (welisacommerce.GetStockLevelRequest.StockItem item : request.stockItems) {            welisacommerce.StockLevelItem stockLevelItem = new welisacommerce.StockLevelItem();            stockLevelItem.productId = item.productId;            stockLevelItem.stockLevel = getStockLevelForProduct(item.productId, item.pricebookId);            response.stockLevelItems.add(stockLevelItem);        }        return response;    }    private Integer getStockLevelForProduct(Id productId, Id pricebookId) {        // Custom logic to fetch stock level for the given product and pricebook        return 100; // Example stock level    } } ```