Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
I'm trying to execute a Graph QL mutation in a flow HTTP request to update a fulfilment item's location. I've tested this in postman successfully several times, but my request fails in Shopify Flow. Here's my code:
{
"query":"mutation fulfillmentOrderMove($id: ID!, $newLocationId: ID!) { fulfillmentOrderMove(id: $id, newLocationId: $newLocationId) { movedFulfillmentOrder { id status } originalFulfillmentOrder { id status } remainingFulfillmentOrder { id status } userErrors { field message } }
}",
"variables": {
"newLocationId": "gid://shopify/Location/XXXXXXXXX",
"id":"{% for fulfillmentOrders_item in order.fulfillmentOrders %}
{{fulfillmentOrders_item.id}}
{% endfor %}"
}
}
Headers are:
Key : X-Shopify-Access-Token | Value: : *********
Key: Content-Type | Value: application/json
URL: https://MYSTORE.myshopify.com/admin/api/2023-01/graphql.json
Hi,
I think the problem is that the liquid is padding the "id" variable with a whitespace at the start and end, so it ends up with `"id": " gid://shopify/FulfillmentOrder/xxxxxxxxx "`.
Try removing the indentation and any spacing around the liquid
To learn more visit the Shopify Help Center or the Community Blog.
Hi Steve,
Thanks for this. I've updated the https request, but it's still unsuccessful.
Here's the error code that I get:
{"status":400,"response_body":"Bad Request","verb":"POST",
"url":"https://mxxxxxx3.myshopify.com/admin/api/2023-01/graphql.json",
"request_body":"
{ “query”:“mutation fulfillmentOrderMove($id: ID!, $newLocationId: ID!) { fulfillmentOrderMove(id: $id, newLocationId: $newLocationId) { movedFulfillmentOrder { id status } originalFulfillmentOrder { id status } remainingFulfillmentOrder { id status } userErrors { field message } } }”,
“variables”: { “newLocationId”: “gid://shopify/Location/7xxxxxxxxx5”, “id”:“gid://shopify/FulfillmentOrder/6xxxxxxxx1”}}"}
There's no padding around the "id" variable, but the request still fails.
Hey,
I'm looking through request logs and I'm seeing errors like:
"None of the items are stocked at the new location" and "Cannot move to the current origin location." returned from the mutation.
I'm not too familiar with the fulfilment's api (I work on Flow), but I'd suggest seeing if it's possible to add a condition before the sendhttp action to check if there is stock at the new location, or if the fulfillmentOrder is already being fulfilled from the location.
To learn more visit the Shopify Help Center or the Community Blog.
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