Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
I received this message when using GraphQL. Could you help please?
{ "errors": [ { "message": "Internal error. Looks like something went wrong on our end.\nRequest ID: 25ea121b-2774-4772-9e01-f104fa28dbec (include this in support requests).", "extensions": { "code": "INTERNAL_SERVER_ERROR", "requestId": "25ea121b-2774-4772-9e01-f104fa28dbec" } } ] }
This is my code, the order Id was taken from the query above
query main { orders(first: 5) { edges{ node { id closed } } pageInfo { hasNextPage } } } mutation delorder { second: metafieldDelete(input: { id: "gid://shopify/Order/2094635679805" }) { userErrors {field message } deletedId } }
Please notice that with the id encoded in base64, the error is the same
Solved! Go to the solution
This is an accepted solution.
Ah, I misunderstood - I thought you were trying to delete metafields.
I can't see an orderDelete mutation, you might need to use the REST API instead.
Scott | Developer Advocate @ Shopify
Hey @jirnmy
The id should be the ID of the metafield to delete. Have you tried:
mutation metafieldDelete($input: MetafieldDeleteInput!) { metafieldDelete(input: $input) { deletedId userErrors { field message } } }
{
"input": { "id": "Z2lkOi8vU2hvcGlmeS9FeGFtcGxlLzE=" }
}
Scott | Developer Advocate @ Shopify
Hi @SBD_
Could you take a look at my query please? I first get the IDs from the `main` query. And then use the IDs from that to delete the Meta in `delorder`.
Could you help point out where I'm wrong?
Thanks!
Hey @jirnmy
You'll need the metafield ID, not the order ID. Try something like this:
{ orders(first:1) { edges { node { id metafields (first:1) { edges { node { id } } } } } } } mutation metafieldDelete($input: MetafieldDeleteInput!) { metafieldDelete(input: $input) { deletedId userErrors { field message } } } { "input": { "id": "gid://shopify/Metafield/1234" } }
Scott | Developer Advocate @ Shopify
@SBD_ Thanks! I understand now.
However, the metafield query doesn't give me any Ids? What could be the problem?
The order I'm checking has the status of Cancelled. It's displaying the delete button when viewing order's detail.
What's the order ID?
Scott | Developer Advocate @ Shopify
Here is the response, please help, thanks!
{ "data": { "orders": { "edges": [ { "node": { "id": "gid://shopify/Order/2119891517501", "metafields": { "edges": [] } } } ] } }, "extensions": { "cost": { "requestedQueryCost": 6, "actualQueryCost": 5, "throttleStatus": { "maximumAvailable": 1000, "currentlyAvailable": 995, "restoreRate": 50 } } } }
My main purpose is to delete this Order. It is deletable in the Admin panel.
I want to delete it with the API. Could you help please?
This is an accepted solution.
Ah, I misunderstood - I thought you were trying to delete metafields.
I can't see an orderDelete mutation, you might need to use the REST API instead.
Scott | Developer Advocate @ Shopify
I see.
I read some articles on the internet and it said that metafield can be used to delete Orders.
I will go for REST then. Thanks for your help!