How can I get the inventory qty only for one location?

Hello,

I’m showing an available qty on my product page. We have ‘buy with prime’ items connected to our store. So when I use this variable ‘variant.inventory_quantity’, it shows the total inventory qty of both our warehouse and FBA items. Is there any way that I can only show the inventory level of our location?

F.Y.I. the code I put into my theme’s custom liquid section is,

{% assign totalProductsQuantity = 0 %}

{% for variant in product.variants %}
{% assign totalProductsQuantity = totalProductsQuantity | plus: variant.inventory_quantity %}
{% endfor %}

{% unless product.tags contains ‘bwp’ %}
{% if product.has_only_default_variant %}
{% if totalProductsQuantity > 0 %}

{{ totalProductsQuantity }} In Stock

{% endif %} {% endif %} {% endunless %}

Thank you!

No , currently liquid only gives an aggregate.

You would need an app to populate metafields with that data mechanic has a starting point task

https://tasks.mechanic.dev/sync-inventory-levels-to-variant-metafields , though this may also be possible with shopify flow.