Pull inventory quantity of a specific variant and display in custom section.

JackDesigns10
New Member
2 0 0

I'm using a dummy product with variants that update their inventory with a zapier connection. I'm using the inventory quantitiess of these variants in this dummy product to display specific data I need on the announcement bar, like 'days remaining' and others. It's a nice workaround to displaying info from a Google Sheet

Anyways, I have the id of the variant I need displayed. I need to display the inventory quantity of a specific variant id in a page that is not a product page.

How would I go about this?

Here's what I have so far:

{% assign some_handle = 'project-data' %}
{% assign custom_product = all_products[some_handle] %}
{% assign days_remaining_id = '41751434952868 ' %}

{% for variants in custom_product %}
<span id="{{ days_remaining_id }}">{{ variant.inventory_quantity }}</span>
{% endfor %}

This isn't working of course. Your help is appreciated

0 Likes
JackDesigns10
New Member
2 0 0

I found a solution:


<span >{{ custom_product.variants[0].inventory_quantity }}</span>

 

The 0 is the first variant in the list. 1 would be the second. This works

0 Likes