Hi all. I am looking to add remaining quantity to my products and variants in my Shopify site. We are currently using the Refresh theme and whilst I can find instructions on Google to add code to the product-template.liquid, I can’t find this in the code list for Refresh theme.
Can anyone guide on a way to add stock remaining quantity number in this theme?
Hi @WDM_Samuel
Refresh theme has Inventory status function by default. You just need to add this block from your theme customize
Hi @WDM_Samuel
This is Noah from PageFly - Shopify Page Builder App
Because each theme will have different structures. In the Refresh theme they handled the product in another file name: main-product.liquid.
You can try to add the code here, where you want it to show the stock and code to handle update the stock
Hope this can help you solve the issue
Best regards,
Noah | PageFly
Hello @WDM_Samuel ,
You can try to follow these steps:
Go to Online Store → Themes → Actions → Edit code
Go to Sections → product-template.liquid file
Locate the loop that iterates through the product variants. It typically starts with something like {% for variant in product.variants %}. Modify it like this:
{% for variant in product.variants %}
{% assign remaining_quantity = product.inventory_quantity - variant.inventory_quantity %}
{{ remaining_quantity }} units available
{% endfor %}
Save and preview
Hope this can help.
Transcy
Thank so much! I didn’t see this at all! I really appreciate it.
I’m not finding this. Could the updated Refresh theme be different? If so, could you provide a work around for this?
1 Like
Could you take screenshot of your product page template?
I was able to find in the theme to add the Inventory Status. But I would like to have it where the customer is only able to select the amount of inventory we have in stock for that item from the quantity dropdown. Is there a way I could do that within the Refresh Theme? And also have the cart reflect the same. Example: if we only have 2 in stock, the cart will only allow 2 to be added.