I tried using isSaleable(), getSaleableItem(), is_in_stock, without success.
I'm new to Magento and I don't have much knowledge.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
Try this in final_price.phtml file
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $productStockObj = $objectManager->get('Magento\CatalogInventory\Api\StockRegistryInterface')->getStockItem($productId);
and you can add condition like this