Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
Hi, I have been trying for many hours trying to send a flow request that lessens an inventory item by 1. The request is successful according to Shopify Flow however my inventory remains unaffected. This means that my api key and query format must be correct however maybe I am missing something or my syntax is off. Totally stumped on this. If anyone has any ideas, would really appreciate any help
I referenced the following to build a query
https://help.shopify.com/en/manual/shopify-flow/reference/actions/send-http-request
and
{"query": "mutation {inventoryAdjustQuantity(input:{inventoryLevelId: \"gid://shopify/InventoryLevel/73357459772?inventory_item_id=48137018704188\" availableDelta: -1}){inventoryLevel {available}}}"}
Solved! Go to the solution
This is an accepted solution.
Hey Paul, thanks for getting back to me, really appreciate it. The error previously was
{"status":400,"response_body":"Bad Request","verb":"POST","url":"https://mystore.myshopify.com/admin/api/2023-07/graphql.json","request_body":"mutation {\n inventoryAdjustQuantity(\n input:{\n inventoryLevelId: \"gid://shopify/InventoryLevel/73357459772?inventory_item_id=48137018704188\"\n availableDelta: -1\n }\n )\n {\n inventoryLevel {\n available\n }\n }\n }"}
however there were no errors on the query I posted initially in my question, hence my confusion.
I actually figured out how to achieve what I wanted however. I ended up using the URL:
https://mystore.myshopify.com/admin/api/2023-07/inventory_levels/adjust.json
along with a much simpler JSON that seems to do the trick
{"location_id": 73357459772, "inventory_item_id": 48137018704188, "available_adjustment": -1}.
Perhaps you could shed some light on the difference of using graphql vs adjust.json as urls to POST to? I really didn't understand why it seemed like there were more than one way to accomplish the same thing (using the documentation I posted above). Thanks again
Have you looked at the workflow run log to see if there is an error? If so, what does it say?
This is an accepted solution.
Hey Paul, thanks for getting back to me, really appreciate it. The error previously was
{"status":400,"response_body":"Bad Request","verb":"POST","url":"https://mystore.myshopify.com/admin/api/2023-07/graphql.json","request_body":"mutation {\n inventoryAdjustQuantity(\n input:{\n inventoryLevelId: \"gid://shopify/InventoryLevel/73357459772?inventory_item_id=48137018704188\"\n availableDelta: -1\n }\n )\n {\n inventoryLevel {\n available\n }\n }\n }"}
however there were no errors on the query I posted initially in my question, hence my confusion.
I actually figured out how to achieve what I wanted however. I ended up using the URL:
https://mystore.myshopify.com/admin/api/2023-07/inventory_levels/adjust.json
along with a much simpler JSON that seems to do the trick
{"location_id": 73357459772, "inventory_item_id": 48137018704188, "available_adjustment": -1}.
Perhaps you could shed some light on the difference of using graphql vs adjust.json as urls to POST to? I really didn't understand why it seemed like there were more than one way to accomplish the same thing (using the documentation I posted above). Thanks again
REST is easier in that action for sure. Shopify supports 2 Admin APIs (REST vs GraphQL). The latter is generally preferred because it allows traversing a graph better than REST and allows you to only request the data you need.
Thanks Paul for your help
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024