jirnmy
1
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
SBD
2
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=" }
}
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!
SBD
4
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"
}
}
1 Like
@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.
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
}
}
}
}
SBD
8
Hey @jirnmy
That order doesn’t appear to have any metafields.
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?
SBD
10
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.
jirnmy
11
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!