Different inventory_quantity values from the return of product variant and ProductListing APIs

Solved
SeanZ
Excursionist
15 2 3

The return of retrieving inventory quantity of one single variant differentiate from the one of product list REST API.

  • Single variant: GET variants/{variant_id}.json, x-request-id: f1aba64b-ae61-45f7-b670-c2fc48863b02
  • Product listing: GET product_listings.json, x-request-id: d8cc4665-0afc-4809-819d-4da7b8166aa3

The values are not the same. Left is 12 and right is 0. It actually should be 12.

PastedGraphic-1.png

0 Likes
_JB
Shopify Staff
Shopify Staff
834 98 188

This is an accepted solution.

Hey @SeanZ,

There's 2 things you can check here. First, try making your calls again using a recent API version. The field you're referring to is supposed to aggregate inventory data from all locations, and this functionality was made available around 2019.

You should also check the location that stocks this variant, and make sure it's included in the fulfillment priority list. If the location isn't set to fulfill online orders, it's expected that the quantity from that location won't be included in the inventory_quantity field when you query using a sales channel app. When using the product listing resource, you'll only see products published to the channel, and inventory available to purchase through the channel.

JB | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

SeanZ
Excursionist
15 2 3

Thank you!

I updated the API version and asked the store admin to check "fulfill online orders" for every location and it works now. The root cause ought to be the latter one.

0 Likes