0

I'm trying to figure out how to show stock status on product page (In stock/Out of stock). I tried to change stock message from the Catalog page but it didn't work ! I guess its because I use a custom theme.

Any tips ? Thanks.

3
  • first of all change to default theme from backend "Magento Blank or Luma" and check on detail page. message is there or not? Commented May 31, 2021 at 13:01
  • Yes the message appears !
    – crowd42
    Commented May 31, 2021 at 13:12
  • that mean your custom theme overrided that code and removed this message Commented May 31, 2021 at 13:15

2 Answers 2

0

go to

/app/design/frontend/Your/Theme/Magento_Catalog/layout/catalog_product_view.xml

and search for

<referenceBlock name='product.info.stock.sku' remove='true'/>

change it to

<referenceBlock name='product.info.stock.sku' remove='false'/>

hope it helps you

3
  • It worked ! "In stock" is now displayed alongside with sku (which I prefer be hidden). But when a product is out of stock, "In stock" is still displayed, but i guess that a problem for another question. Thank you so much for your help.
    – crowd42
    Commented Jun 1, 2021 at 11:18
  • happy to hear it helps you Commented Jun 1, 2021 at 11:41
  • Oops, I forgot :-)
    – crowd42
    Commented Jun 1, 2021 at 11:47
-1

Admin panel -> Go to -> store -> configuration-> Catalog -> Inventory -> Display Products Availability in Stock on Storefront ->Select Yes from the dropdown -> Click on save config button !

Clear the cache and check at frontend - it will not display !

1
  • Bad answer, best to remove it. Commented May 2 at 19:26

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.