Show how many units are left on the product sheet
For those who have templates in their visual editor It does not have the option to show how many units are left of the product, I share the code that you need to paste into your product.liquid or product-template.liquid depending on the template.
Those who have a turbo, this element is located here
The position where you put this code will depend on your template since it will depend on whether you want it above the price or after the purchase button, etc. . So that they don't mess up, never paste it between purple lines since they are generally programming paragraphs that have a beginning like if and an end like endif or endunless and we don't want to make the page. In any case, above each editor are the versions in case we want to go back or do an undo edit. You can paste this code and see on your website where the element is on your page.
<p> {% assign total=0 %} {%for variant in product.variants %} {% capture i %} {{ total | plus:variant.inventory_quantity }} {%endcapture%} {% assign total = i %} {%endfor%} <b>Available Units: </b> {{ total }} </p>
The result would be something like this, it will depend on your staff and where they place it.
Leave a comment
This site is protected by hCaptcha and the hCaptcha Privacy Policy and Terms of Service apply.