How to add inventory levels to a flow in Google Sheets?

Hi I’m using a flow that adds line items of new orders to a Google Sheet. I want to add the stock level of each line item in a particular location to the spreadsheet (I will specify the location)

Can you please assist with the variable to add to the flow - see image below

Hi,

Issue is inventory_stock_level is not available where you ask for it (at order level). Maybe you can make 2 separate flows to fill your Google Sheets.

Another way would be to make a private app and query GraphQL directly (you can do it inside Flow too).

https://shopify.dev/docs/api/admin-graphql

Order / lineItems / variant / inventoryItem / inventoryLevels / location / name

and

Order / lineItems / variant / inventoryItem / inventoryLevels / available

You would need to loop over the levels in your liquid code.

Thanks Paul - how would I add this to the end of the row (current contents below)

{{ order.name }},{{order.createdAt}},{{lineItemsForeachitem.quantity }},{{lineItemsForeachitem.sku }},{{lineItemsForeachitem.title}} - {{lineItemsForeachitem.variant.title}},{{lineItemsForeachitem.vendor}},{{order.customer.displayName}},{{lineItemsForeachitem.discountedTotalSet.shopMoney.amount}},

,{%- for level in lineItemsForeachitem.variant.inventoryItem.inventoryLevels -%}
{% if level.location.name == "Your location name" %}{{ level.available }}{% endif %}
{%- endfor -%}

Hi Paul - the last couple of days the flow has been exporting the price pid for line items EXCLUDING tax but it should be exporting the line item INCLUDING tax.
{{lineItemsForeachitem.discountedTotalSet.shopMoney.amount}},
Has Shopify changed this variable?