# orderDelete - admin-graphql - MUTATION Version: 2024-10 ## Description Deletes an order. For more information on which orders can be deleted, refer to [Delete an order](https://help.shopify.com/manual/orders/cancel-delete-order#delete-an-order). ### Access Scopes `write_orders` access scope. Also: The user must have delete_orders permission. ## Arguments * [orderId](/docs/api/admin-graphql/2024-10/scalars/ID): ID! - The ID of the order to be deleted. ## Returns * [deletedId](/docs/api/admin-graphql/2024-10/scalars/ID): ID Deleted order ID. * [userErrors](/docs/api/admin-graphql/2024-10/objects/OrderDeleteUserError): OrderDeleteUserError! The list of errors that occurred from executing the mutation. ## Examples ### Delete an order Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation OrderDelete($orderId: ID!) { orderDelete(orderId: $orderId) { deletedId userErrors { field message code } } }\",\n \"variables\": {\n \"orderId\": \"gid://shopify/Order/776341364\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation OrderDelete($orderId: ID!) {\n orderDelete(orderId: $orderId) {\n deletedId\n userErrors {\n field\n message\n code\n }\n }\n }`,\n \"variables\": {\n \"orderId\": \"gid://shopify/Order/776341364\"\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation OrderDelete($orderId: ID!) {\n orderDelete(orderId: $orderId) {\n deletedId\n userErrors {\n field\n message\n code\n }\n }\n }\nQUERY\n\nvariables = {\n \"orderId\": \"gid://shopify/Order/776341364\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation OrderDelete($orderId: ID!) {\n orderDelete(orderId: $orderId) {\n deletedId\n userErrors {\n field\n message\n code\n }\n }\n }`,\n {\n variables: {\n \"orderId\": \"gid://shopify/Order/776341364\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation OrderDelete($orderId: ID!) {\n orderDelete(orderId: $orderId) {\n deletedId\n userErrors {\n field\n message\n code\n }\n }\n}" #### Graphql Input { "orderId": "gid://shopify/Order/776341364" } #### Graphql Response { "data": { "orderDelete": { "deletedId": "gid://shopify/Order/776341364", "userErrors": [] } } }