Re: Inventory level inverted on every other API call (inventory_levels/set.json)

Inventory level inverted on every other API call (inventory_levels/set.json)

csilk
Shopify Partner
7 0 0

Hi,

 

A script from within an ERP system is using the inventory_levels/set.json API to set the inventory amount to match what is in the ERP system.

 

I can see that the correct values are sent to Shopify and Shopify responds with a JSON showing success and the new inventory number. It appears that every other API request inverts the quantity even though the Shopify response JSON shows that the inventory was set correctly.

 

Is there something happening on this API that I need to be aware of?

 

The first pic is the inventory in Shopify, you can see that it's setting a positive number followed by a negative (the ERP system ONLY sends a positive number). The second pic is the JSON success response after the incorrect (negative) value is set in Shopify.

 

Screenshot 2022-02-28 at 21.26.22.png

 

If the below JOSN success response (from Shopify) is showing available:400, why is the above pic showing a -186 adjustment?

 

Screenshot 2022-02-28 at 21.26.30.png

Below is the JSON that was sent to the API to set the inventory level, I don't see how this can possibly set a negative number when we're sending "440"

 

{
   location_id: "58189250724",
   inventory_item_id: "39184861036708",
   available: "440"
}

 

EDIT:

 

I've just noticed that one API call was made but the inventory was changed twice

Screenshot 2022-02-28 at 21.50.24.png

You can see the timestamp is the same for both adjustments but the API call was only made once and only one success JSON was returned with inventory: "440"

 

Could this be a bug on the API?

 

Reply 1 (1)

csam
Shopify Staff (Retired)
267 40 51

Hi @csilk 

 

We're going to need a little more info in order to look into this behaviour - could you please fill out the Report an Issue form found under the Partners Support section? Any additional information you can provide around this issue would be very helpful including x-request-ids, product ids, approximate times of the requests, etc.

 

Thanks!

To learn more visit the Shopify Help Center or the Community Blog.