Hi there,
I can’t work out whether this is a problem on my end (i.e. am I using the wrong ID) or if this is a bug with Shopify.
I have a draft order and I want to update it with the Shopify Admin GraphQL API as per https://shopify.dev/docs/admin-api/graphql/reference/orders/draftorderupdate#draftorderinput-fields-2021-01
I have a payload which I am passing into the input (note that this is a reduced version of what I am actually sending, but this should still work).
Mutation:
mutation draftOrderUpdate($id: ID!, $input: DraftOrderInput!) {
draftOrderUpdate(id: $id, input: $input) {
draftOrder {
id
}
userErrors {
field
message
}
}
}
Variables:
{
"id": "gid://shopify/DraftOrder/738221752504",
"input": {
"email": "joe@bloggs.com",
"customerId": "customer-id-here",
"lineItems": [
{
"quantity": 1,
"variantId": "gid://shopify/Product/6186305716408"
}
],
"customAttributes": []
}
}
However, when I try to run this mutation (either in my code or within the Insomnia API tool) I am getting this error:
{
"data": {
"draftOrderUpdate": null
},
"errors": [
{
"message": "invalid id",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [ "draftOrderUpdate"
]
}
]
}
I’m completely at a loss. The only difference (between the payload I am sending and the Shopify example) that I could find was that the format of the order ID is different. See below:
My ID:
gid://shopify/DraftOrder/738221752504
Example ID from link posted earlier:
Z2lkOi8vU2hvcGlmeS9FeGFtcGxlLzE=
The example ID appears to be a base64 string, I decoded this and got:
gid://Shopify/Example/1
So, to rule this out, I also tried encoding my ID as a base64 string and received the same error.
Has anyone else experienced this issue? This functionality is pretty key to the app that I’m developing so I’m in a bit of a situation without this mutation!
Any help would be really appreciated.
Thanks!