Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hello community
We have 2 branches (1 physical store, 1 supplier) I need to show the stock per branch, I am using the following code but it shows me the total stock
Available: 7
{%- for variant in product.variants -%}
{%- assign total_inventory = 0 -%}
{%- for inventory_level in variant.inventory_levels -%}
{%- assign total_inventory = total_inventory | plus: inventory_level.inventory_quantity -%}
{%- endfor -%}
{{ variant.title }}: {{ total_inventory }} en stock
{%- endfor -%}
<br>
{% for location in shop.locations %}
{% if location.active %}
<p>{{ location.name }}</p>
{% endif %}
{% endfor %}
I need it to display something like this:
Physical Store: 2 Available
Exclusive Internet: 5 Available
thanks in advance
I'm not seeing inventory_levels as a field available on the variant liquid object:
https://shopify.dev/docs/api/liquid/objects/variant
One way to do this would be to set up an automated flow to populate the inventory levels by location in a metafield on the product - and then you'd be able to pull it into that liquid there.
Yes, it is what I had planned to do, but since I manage more than 10k products it is a problem to be updating, since the supplier's stock varies a lot
Thanks a hug
If you're open to a 3rd party app, I should be able to build this workflow out for you using our app mesa. 10k products wouldn't be an issue.
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey 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, 2024