How to display a label on a product if the saleable quantity is zero with the code?
1 Answer
You have to override this file
/var/www/html/new_spectrum/vendor/magento/module-catalog/view/frontend/templates/product/list.phtml
in your theme Module_Catalog/view/product/list.phtml
This answer is useful
<?php $objectManager =
\Magento\Framework\App\ObjectManager::getInstance(); $StockState =
$objectManager->get('\Magento\InventorySalesAdminUi\Model\GetSalableQuantityDataBySku');
$qty = $StockState->execute($_product->getSku());
$sale_qty = $qty[0]['qty'];
if($sale_qty == 0) {
echo "Do your code" ;
}