Product_id and Inventory_item_id

Solved
Highlighted
Tourist
6 1 0

Hello All,

 Forgive my ignorance, but i find it very frustrating that Shopify needs Inventory_item_id to be able to update inventory via the API. However, they dont make it easy to get that value. I found some docs on how to grab the Inventory_item_id, but you will need the product_id first to get that to work. 

 

Interestingly, you can only (from what I can see) get the product_id from the product's url. If there is an API call that I can make using the SKU to get the Product ID, then please educate me on it. I have clients that have over 4k SKU, the idea of going into those SKU's one by one to grab the product_id is just unrealistic at the very best. Shopify could have done a better JOB by including either the product_id and or inventory_item_id on the "Product export" feature. This would have been the simplest and most logical thing to do. 

 

I spent the last 5 days, almost 3-4 hrs searching through this, I am yet to find a possible solution that does not results to me wanting to pull my hair out. I am either just too dumb to get this process or the other guys is. 

 

To sum it up?

HOW for the love of God, can I easily get the Product_id without going through each individual product's url, or better yet, how can I easily get the inventory_item_id using the SKU without going through the product_id?

 

Thanks 

0 Likes
Highlighted
Shopify Partner
14 0 0

Hello 

0 Likes
Highlighted
Tourist
6 1 0

Hello,

 Thank you for the insight, I actually found that app after I sent the message, and these guys did an amazing job in being able to pull all the IDs'. If I was a simple personal user, this would have been great. However, I run a fulfilment company, we have lots of customers that sells on Shopify. Some with 10 SKU while others have up to 4K SK's. 

 

The app has a monthly fee, to be able to export the data into excel. Even if they do that, they would then need to load that data somehow in my system because all the inventory lives on my system which has the connection to Shopify. I am very good with excel and can do v-lookups between the data in my system and the data from these guys to match things and then load into my system. Issue is, most people out there are not that good with excel thus making it a bit challenging for them to use the app efficiently. 

 

Bottom line is, I love the app. Love what they did, my hat off for whom ever figure this out. To make it easy for my clients, I have to figure this out as well  somehow :) because I now know that its not impossible. 

 

Sorry for the long reply, but thank you for the response. 

0 Likes
Highlighted
Shopify Partner
14 0 0

Hello Hasimew,

Thank you for appreciating app. Actually this is my app.

So to help you further more, I have an offer for you.

You can tell me exact format of excel which your users wants to export and use on your system.

Your users will not have to play with excel, I will provide them exact the same format which they need & they will have to just export and use it directly on your system. With this you will also save a lots of time on your side.  Further offer is we can deal with some discounts for your users on app.

If you will install it on one of your shop then inside app you will find my communication details.

I am open with ideas.

Best Regards

0 Likes
Highlighted
Shopify Staff
Shopify Staff
516 100 97

Hi @Hasimew 

 

GraphQL or Rest? With either you can use the Product API and use query params to get what you want. For example: https://shopify.dev/docs/admin-api/rest/reference/products/product?api[version]=2020-04#index-2020-0...

 

GET /admin/api/2020-04/products.json?handle="your handle" 

 

Vix | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 


0 Likes
Highlighted
Tourist
6 1 0

This is an accepted solution.

Hello,

 This worked, thank you for the insight

0 Likes
Highlighted
Tourist
6 1 0

Hello,

 I bounced that idea to my partner and it will be complicated to get my clients to go for it as it will involve much more oversight than we need. But thanks for the offer, you did a great job with your app seriously. 

 

Thanks 

0 Likes
Highlighted
Shopify Partner
21 2 1

I am confused:  Did you figure out how to find inventory_item_id based only on the SKU?

 

Basically, I know the SKU ( I store it on my end ), so I just need to get the inventory_item_id for that SKU and then update the inventory.  My users don't need to see it, we only want to manage SKU on our end.  I read all the posts in this thread, but could not really figure out how to do it.

 

I did try the following with my SKU, IT-9284-1000-BSK-LG, and got back the results below, with a bad parameter:

curl -i -X POST https://<API_KEY>:<API_PASSWORD>@<store>.myshopify.com/admin/api/2020-04/products.json?handle="IT-9284-1000-BSK-LG"

HTTP/1.1 400 Bad Request
Date: Sat, 01 Aug 2020 00:42:06 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
... /*http stuff*/

X-Shopify-API-Terms: By accessing or using the Shopify API you agree to the Shopify API License and Terms of Use at https://www.shopify.com/legal/api-terms
HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT: 1/40
X-Shopify-Shop-Api-Call-Limit: 1/40
X-Shopify-API-Version: 2020-04
... /*http stuff*/

{"errors":{"product":"Required parameter missing or invalid"}}

 

0 Likes
Highlighted
Tourist
6 1 0

https://shopify.dev/docs/admin-api/rest/reference/products/product-variant?api[version]=2020-07

this is what we used for get individual item ID based on the sku. It can also get all products, then search each individual item id based on the sku on the local https://shopify.dev/docs/admin-api/rest/reference/products/product?api[version]=2020-07

0 Likes
Highlighted
Shopify Partner
21 2 1

Yes, I already have a script going through all products (using producst.json ), but that is really wasteful to just look for one part, thus this whole question.

 

I don't understand how to use variants to get the item_inventory_id for a given SKU.  I don't see it in the documentation you referenced.  I have read it multiple times and every search it lets you do requires a "product_id" or "variant_id".  I only have the SKU, nothing else.  How did you do that?  I am reading between the lines, but maybe you did this:

  1. Somehow get product_id ( still not entirely sure how you did that, but separate question )
  2. Used product_id to get item_inventory_id using variants.json stuff ( your first link )

I guess my confusion is how to get the product_id if you only have the SKU?  How do you search by SKU via the API?  The example in the answer that I think was accepted said

GET /admin/api/2020-04/products.json?handle="your handle"

But I tried that, assuming "handle=<sku>" would work, and it did not.  So you must be doing something else.  I really hope you don't have to do a two step process like I assume above, but maybe you do and maybe I just need to know how to do the first step correctly.  Any help on the actual command to search for a given SKU would be much appreciated.

0 Likes