I am trying to update shopify variant’s inventory quantity by SKU,
but i am not getting how to do it by there dev docs,
here is what i’ve done,
i installed https://github.com/Shopify/shopify_python_api and written below code, and the code is working fine, but not sure how to get variant by sku and update its available quantity on shopify.
shop_url = "https://%s:%[email protected]/admin/api/%s" % (API_KEY, PASSWORD, API_VERSION)
shopify.ShopifyResource.set_site(shop_url)
shop = shopify.Shop.current()
product = shopify.Product.find(4398162804809)
print(product)
2
Answers
i used graphql query and it returns me the following details,
Now i am looking for exact graphql query which should return me the exact product id and variant id.
SKU’s are not unique values. You can have all of your variants to have the same SKU which is not usable. That’s why you can’t update them by SKU, but only by ID.
There is no way to get variants by SKU with the REST API if I’m not mistaken.
For that you will need to look into GraphQL: