How to retrieve the Variant of an InventoryItem ?

New Member
2 0 0



I'm trying to retrieve the variant from it's inventory item with the REST Admin API.


More precisely I subscribed to the webhook `inventory_items/update`, and receives an InventoryItem as indicated in the documentation (see picture 1 at the end). As you can see there's no `variant_id` field. So I tried to look up an endpoint to retrieve variants by filter with `inventory_item_ids` but couldn't find one in the documentation (see picture 2 at the end). 


I saw that this was possible with the GraphQL api but we're not supporting it.


Thanks a lot !


Picture 1

Screen Shot 2019-09-19 at 18.58.04.png


Picture 2

Screen Shot 2019-09-19 at 19.12.21.png

Shopify Staff
Shopify Staff
618 45 84

Hi @Elrendio,


You would need to use the GraphQL admin API in order to fetch the variant id if all you have is the inventory_item_id. We don't currently support filtering searching for variants by the associated inventory id in REST.


If your app is using a library to connect to Shopify's API, chances are it supports making GraphQL requests. We made an effort around the time we hosted Unite to make sure as many libraries support making GraphQL calls to Shopify. 


If your app isn't using a library and you need support migrating to using some GraphQL calls, don't hesitate to post back here or create a support ticket in your partner dashboard.

New Member
2 0 0

Hello Busfox,


WOW ! I'm astonished, the docs specify that there's a 1 <> 1 relationship between variants and inventory_item but the information only flows one way !


My app is in Rust and there's no stable library for GraphQl yet. The closest one to a stable version is this one and is currently under high development.


Is there any plan to support this feature which seems to be a classical use case ?


Do you have any other solution in mind to track the evolution of the inventory that doesn't involves pinging your servers every 5 minutes ?


Thanks !