FROM CACHE - en_header

Shopify Admin API - Set variants to 0 after checkout

phillipr
New Member
4 0 0

Hello Shopify community. I need help with an issue I'm having regarding setting variants quantity to 0. I have an AWS lambda function setup that is called from a webhook from Shopify which is trying to set the variants to 0.

I am following this documentation here: https://shopify.dev/docs/admin-api/rest/reference/inventory/inventorylevel#set-2020-07

For some reason, I am not able to set the inventory level to 0. I tried doing this directly inside of my Node.js server and with Postman. Both options give me failing results. In my node.js server I'm using this library: https://github.com/MONEI/Shopify-api-node to interface with the admin API. The library works great, but when I try to set the inventory level to 0, nothing happens.

So, I tried to do the same thing in Postman but when I tried to login it keeps showing me this error:

image.png


Any idea's why it's so difficult to update the variant quantity via the Admin API? My API key and password are working fine, I am making several other Admin API requests BEFORE trying to set the variants to 0. Any ideas?

Replies 6 (6)
2BDigital
Shopify Partner
152 37 48

Hi @phillipr 

Can you send us the body you're sending and the exact endpoint you're hitting?

I usually try and get it to work in Postman first so I know that the call is formatted correctly before moving on to anything else.

Can you GET the inventory level endpoints without any trouble?

phillipr
New Member
4 0 0

Hi @2BDigital , thanks for the response. Yes, I am 100% able to GET inventory level endpoints without any trouble.

Here, I'm making a GET request for all inventory levels for a specific location. We only have one location, no plans for multi-locations. Works perfectly.

f1e5600b37ea9348054cde75a161f4b1.png

 

And then here is my request trying to set the available to 1 using the exact data from the previous GET request. It sends me the href link, and I open it in chrome and it says "Something went wrong", as seen above in the original post.

fb711282462f2eaec1b192b5bed7ef92.png

Any ideas?

phillipr
New Member
4 0 0

@2BDigital I also have read write permissions active for inventory and products.
image.png

2BDigital
Shopify Partner
152 37 48

What's the HTTP response code of the call?

You're definitely not being hit by this?

Setting an inventory item to a fulfillment service without"disconnect_if_necessary": truefails with a 422 error

For the sake of argument as well - let's give write access to Locations as well then retry?

phillipr
New Member
4 0 0

For the sake of argument as well - let's give write access to Locations as well then retry?

We can't put write access on locations, just checked.

What's the HTTP response code of the call?

Getting a status 200

image.png

And there's no message about "disconnect_if_necessary".

2BDigital
Shopify Partner
152 37 48

Hmm - how strange.

According to this thread there might be some issues with cookies in Postman?

Can you try removing any cookies and trying the post again?

Sorry I am clutching at straws a bit here but anything's worth trying at this point!

I don't see anything wrong with the request or permission levels.