Gets information about the inventory of the item, such as whether the item is in stock, the quantity in stock, and the in-stock and out-of-stock messages. If the item is an inventory item, it returns the available quantity of the item. If the item is a matrix item and subitems are filtered (with getSelectedMatrixChilds()), it returns the sum of the available quantity of all the filtered subitems of the matrix item.
var pdp = container.getComponent(‘PDP’);
var stockinfo = pdp.getStockInfo();
var totalstock = stockinfo.stock;
var isinstock = stockinfo.isInStock;
Returns a StockInfo object. If the current view is not in the PDP component, it returns null.