metafield Deletemutation deprecated
mutation
2024-10latest
Deletes a metafield. This mutation will be removed in a future version. Use metafields
instead.
Arguments
Was this section helpful?
MetafieldDeletePayload returns
The ID of the deleted metafield.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Code examples for MUTATION: metafieldDelete
Query Reference for MUTATION: metafieldDelete
"mutation metafieldDelete($input: MetafieldDeleteInput!) {\n metafieldDelete(input: $input) {\n deletedId\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: metafieldDelete
"{\n \"input\": {\n \"id\": \"gid://shopify/<objectName>/10079785100\"\n }\n}"
Schema Reference for MUTATION: metafieldDelete
"input MetafieldDeleteInput {\n id: ID!\n}\n"
Display Examples for MUTATION: metafieldDelete
[ { "example": { "type_name": "metafielddelete", "title": "Deletes a metafield", "description": "Delete an existing metafield using its ID.\n", "query_string": "mutation metafieldDelete($input: MetafieldDeleteInput!) {\n metafieldDelete(input: $input) {\n deletedId\n userErrors {\n field\n message\n }\n }\n}", "variables": { "input": { "id": "gid://shopify/Metafield/1069228997" } }, "response": { "data": { "metafieldDelete": { "deletedId": "gid://shopify/Metafield/1069228997", "userErrors": [] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/content/metafields/test/unit/graph_api/admin/mutations/metafield_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 metafieldDelete($input: MetafieldDeleteInput!) { metafieldDelete(input: $input) { deletedId userErrors { field message } } }\",\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Metafield/1069228997\"\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation metafieldDelete($input: MetafieldDeleteInput!) {\n metafieldDelete(input: $input) {\n deletedId\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"id\": \"gid://shopify/Metafield/1069228997\"\n }\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 metafieldDelete($input: MetafieldDeleteInput!) {\n metafieldDelete(input: $input) {\n deletedId\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"id\": \"gid://shopify/Metafield/1069228997\"\n }\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 metafieldDelete($input: MetafieldDeleteInput!) {\n metafieldDelete(input: $input) {\n deletedId\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Metafield/1069228997\"\n }\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 metafieldDelete($input: MetafieldDeleteInput!) {\n metafieldDelete(input: $input) {\n deletedId\n userErrors {\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [\n \"id\" => \"gid://shopify/Metafield/1069228997\",\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "input", "description": null, "type": { "kind": "INPUT_OBJECT", "name": "MetafieldDeleteInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "MetafieldDeleteInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "input", "argValue": " {\"id\":\"gid://shopify/Metafield/1069228997\"}", "typeKind": "MUTATION" } ] } ]