All things Shopify and commerce
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?
Solved! Go to the solution
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 }}
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 }}
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.
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
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
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024