How to add "In Stock" message on product page?

magicwheels
New Member
2 0 0

Hello,
I would like to be able to display "In Stock" label on the product page for customers to see when they view a product that is in stock. I am using the "Supply" theme. Google merchant center requires that display function now.

Currently, the theme only displays a "sold out" label for products that are out of stock on the individual product pages.

How would I go about doing this?
Thank you.

0 Likes
HardikDavra
Shopify Partner
2418 375 1024

@magicwheels 

Please Go to Online Store -> Themes -> Edit code -> Sections -> product-template.liquid and paste this code whereever you want to set.

{% if product.selected_or_first_available_variant.available == true %}
    <p>In Stock</p>
{% endif %}

 

For fast Communication: Email: parambabla.soft@gmail.com | Whatsapp
dmwwebartisan
Shopify Partner
8375 1967 2647

@magicwheels 

Please Go to Online Store -> Themes -> Edit code -> Sections -> product-template.liquid and paste this code whereever you want to set.

{% comment %} Inventory tracking on product page {% endcomment %}
            <div id="variant-inventory" class="{% unless current_variant.available %} hide {% endunless %}">
              {% if current_variant.inventory_management == "shopify" and current_variant.inventory_policy != "continue" %}
              We have {{ current_variant.inventory_quantity }} in stock.
              {% else %}
              This product is available.
              {% endif %}
            </div>
If helpful then please Like and Accept Solution | Email: dmw.webartisan@gmail.com | Instagram: @dmw.webartisan
Check here PageFly App to customize your pages | Bag is a cart drawer that maximizes your sales. View app →
magicwheels
New Member
2 0 0

Thank you very much for help, I have pasted into the  product-template.liquid section, but the "In Stock" sign didn't show up, may be I pasted to wrong position? is there a specific line I should paste? thanks

0 Likes
dmwwebartisan
Shopify Partner
8375 1967 2647

@magicwheels 

Please share your Sections/product-template.liquid  file code .

Thanks!

If helpful then please Like and Accept Solution | Email: dmw.webartisan@gmail.com | Instagram: @dmw.webartisan
Check here PageFly App to customize your pages | Bag is a cart drawer that maximizes your sales. View app →