What's your biggest current challenge? Have your say in Community Polls along the right column.

Re: different text after quantity in stock on different products

Solved

different text after quantity in stock on different products

Apawlowski
Excursionist
14 1 3

In Snippets file product-form.liquid I added this code...  so that it places (- half yards in stock) after the quantity.

 

{% if product.variants.first.inventory_quantity %}
{{ product.variants.first.inventory_quantity }} - half yards in stock.
{% else %}
Sold out!
{% endif %}

 

My issue is that I have some products that I just want it to say ( in stock) after the quantity only. 

 

How do I differentiate what I want it to say on different products?

Accepted Solution (1)

Sajeel
Shopify Partner
272 31 26

This is an accepted solution.

you can use meta field it will allow you add different text for different product then you can concatenate the text variable with stock like 

{{ metafield.text }} {{ product.variants.first.inventory_quantity }}

View solution in original post

Replies 4 (4)

Sajeel
Shopify Partner
272 31 26

This is an accepted solution.

you can use meta field it will allow you add different text for different product then you can concatenate the text variable with stock like 

{{ metafield.text }} {{ product.variants.first.inventory_quantity }}

Apawlowski
Excursionist
14 1 3

So how do I change the code I wrote above if I added a true or false meta field name Half-Yard and I wanted the half yard text to only show when the Meta was true. 

Sajeel
Shopify Partner
272 31 26

you just have to add the desired text according to your product it will print the text you don't  need if condition to print half yard or out of stock

Sajeel
Shopify Partner
272 31 26

you can do both methods... you can use java script to get the class of add to cart button if disabled you can show out of stock and if in stock you can show metafield.. All you need is to play with code. i did same on one of our website