How to display a label on a product if the saleable quantity is zero with the code?

  • are there any other approaches, like plugins or observers? May 12, 2022 at 5:51

1 Answer 1


You have to override this file


in your theme Module_Catalog/view/product/list.phtml

This answer is useful

  <?php $objectManager =
     \Magento\Framework\App\ObjectManager::getInstance(); $StockState =
     $qty = $StockState->execute($_product->getSku()); 
     $sale_qty = $qty[0]['qty'];
     if($sale_qty == 0) {    
       echo "Do your code" ; 
  • implemented but not working May 11, 2022 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.