Version: 2024-04
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) { metaobjectDefinitionUpdate(id: $id, definition: $definition) { metaobjectDefinition { id name displayNameKey fieldDefinitions { name key type { name } } } userErrors { field message code } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/MetaobjectDefinition/578408816\",\n \"definition\": {\n \"displayNameKey\": \"description\",\n \"fieldDefinitions\": [\n {\n \"create\": {\n \"key\": \"description\",\n \"name\": \"Description\",\n \"type\": \"single_line_text_field\"\n }\n }\n ]\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n id\n name\n displayNameKey\n fieldDefinitions {\n name\n key\n type {\n name\n }\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/MetaobjectDefinition/578408816\",\n \"definition\": {\n \"displayNameKey\": \"description\",\n \"fieldDefinitions\": [\n {\n \"create\": {\n \"key\": \"description\",\n \"name\": \"Description\",\n \"type\": \"single_line_text_field\"\n }\n }\n ]\n }\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 UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n id\n name\n displayNameKey\n fieldDefinitions {\n name\n key\n type {\n name\n }\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/MetaobjectDefinition/578408816\",\n \"definition\": {\n \"displayNameKey\": \"description\",\n \"fieldDefinitions\": [{\"create\"=>{\"key\"=>\"description\", \"name\"=>\"Description\", \"type\"=>\"single_line_text_field\"}}]\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n id\n name\n displayNameKey\n fieldDefinitions {\n name\n key\n type {\n name\n }\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/MetaobjectDefinition/578408816\",\n \"definition\" => [\n \"displayNameKey\" => \"description\",\n \"fieldDefinitions\" => [{\"create\"=>{\"key\"=>\"description\", \"name\"=>\"Description\", \"type\"=>\"single_line_text_field\"}}],\n ],\n];\n\n$response = $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 UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n id\n name\n displayNameKey\n fieldDefinitions {\n name\n key\n type {\n name\n }\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/MetaobjectDefinition/578408816\",\n \"definition\": {\n \"displayNameKey\": \"description\",\n \"fieldDefinitions\": [\n {\n \"create\": {\n \"key\": \"description\",\n \"name\": \"Description\",\n \"type\": \"single_line_text_field\"\n }\n }\n ]\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n id\n name\n displayNameKey\n fieldDefinitions {\n name\n key\n type {\n name\n }\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n}"
input: { "id": "gid://shopify/MetaobjectDefinition/578408816", "definition": { "displayNameKey": "description", "fieldDefinitions": [ { "create": { "key": "description", "name": "Description", "type": "single_line_text_field" } } ] } }
response: { "data": { "metaobjectDefinitionUpdate": { "metaobjectDefinition": { "id": "gid://shopify/MetaobjectDefinition/578408816", "name": "LookBook", "displayNameKey": "description", "fieldDefinitions": [ { "name": "Another Lookbook", "key": "another_lookbook", "type": { "name": "metaobject_reference" } }, { "name": "Season", "key": "cover_image", "type": { "name": "file_reference" } }, { "name": "Season", "key": "season", "type": { "name": "single_line_text_field" } }, { "name": "Year", "key": "year", "type": { "name": "number_integer" } }, { "name": "Description", "key": "description", "type": { "name": "single_line_text_field" } } ] }, "userErrors": [] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) { metaobjectDefinitionUpdate(id: $id, definition: $definition) { metaobjectDefinition { id name fieldDefinitions { name key } } userErrors { field message code } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/MetaobjectDefinition/578408816\",\n \"definition\": {\n \"fieldDefinitions\": [\n {\n \"delete\": {\n \"key\": \"season\"\n }\n }\n ]\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n id\n name\n fieldDefinitions {\n name\n key\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/MetaobjectDefinition/578408816\",\n \"definition\": {\n \"fieldDefinitions\": [\n {\n \"delete\": {\n \"key\": \"season\"\n }\n }\n ]\n }\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 UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n id\n name\n fieldDefinitions {\n name\n key\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/MetaobjectDefinition/578408816\",\n \"definition\": {\n \"fieldDefinitions\": [{\"delete\"=>{\"key\"=>\"season\"}}]\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n id\n name\n fieldDefinitions {\n name\n key\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/MetaobjectDefinition/578408816\",\n \"definition\" => [\n \"fieldDefinitions\" => [{\"delete\"=>{\"key\"=>\"season\"}}],\n ],\n];\n\n$response = $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 UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n id\n name\n fieldDefinitions {\n name\n key\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/MetaobjectDefinition/578408816\",\n \"definition\": {\n \"fieldDefinitions\": [\n {\n \"delete\": {\n \"key\": \"season\"\n }\n }\n ]\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n id\n name\n fieldDefinitions {\n name\n key\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n}"
input: { "id": "gid://shopify/MetaobjectDefinition/578408816", "definition": { "fieldDefinitions": [ { "delete": { "key": "season" } } ] } }
response: { "data": { "metaobjectDefinitionUpdate": { "metaobjectDefinition": { "id": "gid://shopify/MetaobjectDefinition/578408816", "name": "LookBook", "fieldDefinitions": [ { "name": "Another Lookbook", "key": "another_lookbook" }, { "name": "Season", "key": "cover_image" }, { "name": "Year", "key": "year" } ] }, "userErrors": [] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) { metaobjectDefinitionUpdate(id: $id, definition: $definition) { metaobjectDefinition { name fieldDefinitions { name key } } userErrors { field message code } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/MetaobjectDefinition/578408816\",\n \"definition\": {\n \"fieldDefinitions\": [\n {\n \"update\": {\n \"key\": \"season\",\n \"name\": \"Edition\"\n }\n }\n ]\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n name\n fieldDefinitions {\n name\n key\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/MetaobjectDefinition/578408816\",\n \"definition\": {\n \"fieldDefinitions\": [\n {\n \"update\": {\n \"key\": \"season\",\n \"name\": \"Edition\"\n }\n }\n ]\n }\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 UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n name\n fieldDefinitions {\n name\n key\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/MetaobjectDefinition/578408816\",\n \"definition\": {\n \"fieldDefinitions\": [{\"update\"=>{\"key\"=>\"season\", \"name\"=>\"Edition\"}}]\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n name\n fieldDefinitions {\n name\n key\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/MetaobjectDefinition/578408816\",\n \"definition\" => [\n \"fieldDefinitions\" => [{\"update\"=>{\"key\"=>\"season\", \"name\"=>\"Edition\"}}],\n ],\n];\n\n$response = $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 UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n name\n fieldDefinitions {\n name\n key\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/MetaobjectDefinition/578408816\",\n \"definition\": {\n \"fieldDefinitions\": [\n {\n \"update\": {\n \"key\": \"season\",\n \"name\": \"Edition\"\n }\n }\n ]\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n name\n fieldDefinitions {\n name\n key\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n}"
input: { "id": "gid://shopify/MetaobjectDefinition/578408816", "definition": { "fieldDefinitions": [ { "update": { "key": "season", "name": "Edition" } } ] } }
response: { "data": { "metaobjectDefinitionUpdate": { "metaobjectDefinition": { "name": "LookBook", "fieldDefinitions": [ { "name": "Another Lookbook", "key": "another_lookbook" }, { "name": "Season", "key": "cover_image" }, { "name": "Edition", "key": "season" }, { "name": "Year", "key": "year" } ] }, "userErrors": [] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) { metaobjectDefinitionUpdate(id: $id, definition: $definition) { metaobjectDefinition { id name displayNameKey } userErrors { field message code } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/MetaobjectDefinition/578408816\",\n \"definition\": {\n \"name\": \"StyleBook\",\n \"displayNameKey\": \"season\"\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n id\n name\n displayNameKey\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/MetaobjectDefinition/578408816\",\n \"definition\": {\n \"name\": \"StyleBook\",\n \"displayNameKey\": \"season\"\n }\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 UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n id\n name\n displayNameKey\n }\n userErrors {\n field\n message\n code\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/MetaobjectDefinition/578408816\",\n \"definition\": {\n \"name\": \"StyleBook\",\n \"displayNameKey\": \"season\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n id\n name\n displayNameKey\n }\n userErrors {\n field\n message\n code\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/MetaobjectDefinition/578408816\",\n \"definition\" => [\n \"name\" => \"StyleBook\",\n \"displayNameKey\" => \"season\",\n ],\n];\n\n$response = $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 UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n id\n name\n displayNameKey\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/MetaobjectDefinition/578408816\",\n \"definition\": {\n \"name\": \"StyleBook\",\n \"displayNameKey\": \"season\"\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n id\n name\n displayNameKey\n }\n userErrors {\n field\n message\n code\n }\n }\n}"
input: { "id": "gid://shopify/MetaobjectDefinition/578408816", "definition": { "name": "StyleBook", "displayNameKey": "season" } }
response: { "data": { "metaobjectDefinitionUpdate": { "metaobjectDefinition": { "id": "gid://shopify/MetaobjectDefinition/578408816", "name": "StyleBook", "displayNameKey": "season" }, "userErrors": [] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) { metaobjectDefinitionUpdate(id: $id, definition: $definition) { metaobjectDefinition { id name fieldDefinitions { name key } } userErrors { field message code } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/MetaobjectDefinition/228758553\",\n \"definition\": {\n \"resetFieldOrder\": true,\n \"fieldDefinitions\": [\n {\n \"update\": {\n \"key\": \"hex\"\n }\n },\n {\n \"update\": {\n \"key\": \"name\"\n }\n },\n {\n \"update\": {\n \"key\": \"accent_color\"\n }\n }\n ]\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n id\n name\n fieldDefinitions {\n name\n key\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/MetaobjectDefinition/228758553\",\n \"definition\": {\n \"resetFieldOrder\": true,\n \"fieldDefinitions\": [\n {\n \"update\": {\n \"key\": \"hex\"\n }\n },\n {\n \"update\": {\n \"key\": \"name\"\n }\n },\n {\n \"update\": {\n \"key\": \"accent_color\"\n }\n }\n ]\n }\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 UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n id\n name\n fieldDefinitions {\n name\n key\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/MetaobjectDefinition/228758553\",\n \"definition\": {\n \"resetFieldOrder\": true,\n \"fieldDefinitions\": [{\"update\"=>{\"key\"=>\"hex\"}}, {\"update\"=>{\"key\"=>\"name\"}}, {\"update\"=>{\"key\"=>\"accent_color\"}}]\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n id\n name\n fieldDefinitions {\n name\n key\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/MetaobjectDefinition/228758553\",\n \"definition\" => [\n \"resetFieldOrder\" => true,\n \"fieldDefinitions\" => [{\"update\"=>{\"key\"=>\"hex\"}}, {\"update\"=>{\"key\"=>\"name\"}}, {\"update\"=>{\"key\"=>\"accent_color\"}}],\n ],\n];\n\n$response = $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 UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n id\n name\n fieldDefinitions {\n name\n key\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/MetaobjectDefinition/228758553\",\n \"definition\": {\n \"resetFieldOrder\": true,\n \"fieldDefinitions\": [\n {\n \"update\": {\n \"key\": \"hex\"\n }\n },\n {\n \"update\": {\n \"key\": \"name\"\n }\n },\n {\n \"update\": {\n \"key\": \"accent_color\"\n }\n }\n ]\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation UpdateMetaobjectDefinition($id: ID!, $definition: MetaobjectDefinitionUpdateInput!) {\n metaobjectDefinitionUpdate(id: $id, definition: $definition) {\n metaobjectDefinition {\n id\n name\n fieldDefinitions {\n name\n key\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n}"
input: { "id": "gid://shopify/MetaobjectDefinition/228758553", "definition": { "resetFieldOrder": true, "fieldDefinitions": [ { "update": { "key": "hex" } }, { "update": { "key": "name" } }, { "update": { "key": "accent_color" } } ] } }
response: { "data": { "metaobjectDefinitionUpdate": { "metaobjectDefinition": { "id": "gid://shopify/MetaobjectDefinition/228758553", "name": "Color", "fieldDefinitions": [ { "name": "Hex code", "key": "hex" }, { "name": "Name", "key": "name" }, { "name": "Accent color", "key": "accent_color" }, { "name": "Related colors", "key": "related_colors" }, { "name": "Secondary Hex code", "key": "secondary_hex" } ] }, "userErrors": [] } } }