This question has been answered for Magento 1. (see: here). As I am migrating to Magento2 and need the same logic here is the issue:

I am trying to figure a way to hide show stock status/availability on the product page unless it is out of stock. I have all the settings configured to where it displays stock status on the front end as normal, however, I don't want to show "In Stock" only if the item is out of stock then I want it to display Availability "Out of Stock" only. A lot of our items are ordered through other vendors and drop-shipped to the customer therefore I don't want to display stock status on those items. Only the items we exclusively ship from our location.

2 Answers 2


If you just need to hide the stock status when it would show "In Stock", you could add a CSS rule:

.product-info-stock-sku .available {
    display: none;

In stock/Out of stock is shown from template file vendor/magento/module-catalog/view/frontend/templates/product/view/type/default.phtml

You need to add this template file in your custom theme and make your changes there.

You can add this file in your theme at location app/design/frontend/Vendor/custom_theme/Magento_Catalog/templates/product/view/type/default.phtml

In this template file, value of $_product->isAvailable() will be true if product is in stock.

  • sorry wrong phrasing. Right phrasing of question is in post: 348444
    – RoboxFuze
    Commented Oct 18, 2021 at 8:08

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.