menu Deletemutation
mutation
2024-10latest
Requires write
access scope.
Deletes a menu.
Arguments
The ID of the menu to be deleted.
Was this section helpful?
MenuDeletePayload returns
Anchor to MenuDeletePayload.deletedMenuIddeletedMenu Id The ID of the deleted menu.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Code examples for MUTATION: menuDelete
Query Reference for MUTATION: menuDelete
"mutation menuDelete($id: ID!) {\n menuDelete(id: $id) {\n deletedMenuId\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: menuDelete
"{\n \"id\": \"gid://shopify/<objectName>/10079785100\"\n}"
Schema Reference for MUTATION: menuDelete
""
Display Examples for MUTATION: menuDelete
[ { "example": { "type_name": "menudelete", "title": "Failing to delete the main menu", "description": "Deleting the main menu returns an error", "query_string": "mutation DeleteMenu($id: ID!) {\n menuDelete(id: $id) {\n deletedMenuId\n userErrors {\n field\n message\n }\n }\n}", "variables": { "id": "gid://shopify/Menu/166235728" }, "response": { "data": { "menuDelete": { "deletedMenuId": null, "userErrors": [ { "field": [ "id" ], "message": "Default menu cannot be deleted." } ] } } }, "api_name": "admin", "minimum_api_version": "2024-07", "maximum_api_version": "unstable", "location": "/components/online_store/test/unit/graph_api/admin/mutations/menu_delete_test.rb", "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 DeleteMenu($id: ID!) { menuDelete(id: $id) { deletedMenuId userErrors { field message } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Menu/166235728\"\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation DeleteMenu($id: ID!) {\n menuDelete(id: $id) {\n deletedMenuId\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Menu/166235728\"\n },\n },\n);\n\nconst data = await response.json();\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 DeleteMenu($id: ID!) {\n menuDelete(id: $id) {\n deletedMenuId\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Menu/166235728\"\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation DeleteMenu($id: ID!) {\n menuDelete(id: $id) {\n deletedMenuId\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Menu/166235728\"\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation DeleteMenu($id: ID!) {\n menuDelete(id: $id) {\n deletedMenuId\n userErrors {\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/Menu/166235728\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the menu to be deleted.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "id", "argValue": " \"gid://shopify/Menu/166235728\"", "typeKind": "MUTATION" } ] }, { "example": { "type_name": "menudelete", "title": "Successfully deleting a menu", "description": "Delete a menu by its ID", "query_string": "mutation DeleteMenu($id: ID!) {\n menuDelete(id: $id) {\n deletedMenuId\n }\n}", "variables": { "id": "gid://shopify/Menu/166235728" }, "response": { "data": { "menuDelete": { "deletedMenuId": "gid://shopify/Menu/166235728" } } }, "api_name": "admin", "minimum_api_version": "2024-07", "maximum_api_version": "unstable", "location": "/components/online_store/test/unit/graph_api/admin/mutations/menu_delete_test.rb", "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 DeleteMenu($id: ID!) { menuDelete(id: $id) { deletedMenuId } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Menu/166235728\"\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation DeleteMenu($id: ID!) {\n menuDelete(id: $id) {\n deletedMenuId\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Menu/166235728\"\n },\n },\n);\n\nconst data = await response.json();\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 DeleteMenu($id: ID!) {\n menuDelete(id: $id) {\n deletedMenuId\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Menu/166235728\"\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation DeleteMenu($id: ID!) {\n menuDelete(id: $id) {\n deletedMenuId\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Menu/166235728\"\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation DeleteMenu($id: ID!) {\n menuDelete(id: $id) {\n deletedMenuId\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/Menu/166235728\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the menu to be deleted.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "id", "argValue": " \"gid://shopify/Menu/166235728\"", "typeKind": "MUTATION" } ] } ]