I want to display Product Salable Quantity, on Category view page.
On \app\design\frontend\Smartwave\porto\Magento_Catalog\templates\product\list.phtml
added the follow code:
<?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $StockState = $objectManager->get('\Magento\InventorySalesAdminUi\Model\GetSalableQuantityDataBySku'); $qty = $StockState->execute($_product->getSku()); echo ($qty[0]['qty']); ?> form this post And it is works fine, but not for all categories pages. If in category view there are "Configurable Products" i get this error:
1 exception(s): Exception #0 (Exception): Notice: Undefined offset: 0 in /var/www/vhosts/glowfashion.gr/httpdocs/app/design/frontend/Smartwave/porto/Magento_Catalog/templates/product/list.phtml on line 239 line 239: echo ($qty[0]['qty']);
i want to display the lower quantity of "Configurable Sub Products". Any idea?