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 updateCollectionRules($input: CollectionInput!) { collectionUpdate(input: $input) { collection { id title description handle ruleSet { rules { column relation condition } appliedDisjunctively } } userErrors { field message } } }\",\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Collection/442946009\",\n \"ruleSet\": {\n \"rules\": [\n {\n \"column\": \"IS_PRICE_REDUCED\",\n \"relation\": \"IS_NOT_SET\",\n \"condition\": \"\"\n }\n ],\n \"appliedDisjunctively\": true\n }\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation updateCollectionRules($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n title\n description\n handle\n ruleSet {\n rules {\n column\n relation\n condition\n }\n appliedDisjunctively\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Collection/442946009\",\n \"ruleSet\": {\n \"rules\": [\n {\n \"column\": \"IS_PRICE_REDUCED\",\n \"relation\": \"IS_NOT_SET\",\n \"condition\": \"\"\n }\n ],\n \"appliedDisjunctively\": true\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 updateCollectionRules($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n title\n description\n handle\n ruleSet {\n rules {\n column\n relation\n condition\n }\n appliedDisjunctively\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"id\": \"gid://shopify/Collection/442946009\",\n \"ruleSet\": {\n \"rules\": [{\"column\"=>\"IS_PRICE_REDUCED\", \"relation\"=>\"IS_NOT_SET\", \"condition\"=>\"\"}],\n \"appliedDisjunctively\": true\n }\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 updateCollectionRules($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n title\n description\n handle\n ruleSet {\n rules {\n column\n relation\n condition\n }\n appliedDisjunctively\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [\n \"id\" => \"gid://shopify/Collection/442946009\",\n \"ruleSet\" => [\n \"rules\" => [{\"column\"=>\"IS_PRICE_REDUCED\", \"relation\"=>\"IS_NOT_SET\", \"condition\"=>\"\"}],\n \"appliedDisjunctively\" => true,\n ],\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 updateCollectionRules($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n title\n description\n handle\n ruleSet {\n rules {\n column\n relation\n condition\n }\n appliedDisjunctively\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"id\": \"gid://shopify/Collection/442946009\",\n \"ruleSet\": {\n \"rules\": [\n {\n \"column\": \"IS_PRICE_REDUCED\",\n \"relation\": \"IS_NOT_SET\",\n \"condition\": \"\"\n }\n ],\n \"appliedDisjunctively\": true\n }\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation updateCollectionRules($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n title\n description\n handle\n ruleSet {\n rules {\n column\n relation\n condition\n }\n appliedDisjunctively\n }\n }\n userErrors {\n field\n message\n }\n }\n}"
input: { "input": { "id": "gid://shopify/Collection/442946009", "ruleSet": { "rules": [ { "column": "IS_PRICE_REDUCED", "relation": "IS_NOT_SET", "condition": "" } ], "appliedDisjunctively": true } } }
response: { "data": { "collectionUpdate": { "collection": null, "userErrors": [ { "field": [ "id" ], "message": "Cannot update rule set of a custom collection" } ] } } }
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 updateCollectionMetafields($input: CollectionInput!) { collectionUpdate(input: $input) { collection { id metafields(first: 3) { edges { node { id namespace key value } } } } userErrors { message field } } }\",\n \"variables\": {\n \"input\": {\n \"metafields\": [\n {\n \"namespace\": \"my_field\",\n \"key\": \"subtitle\",\n \"type\": \"single_line_text_field\",\n \"value\": \"Bold Colors\"\n },\n {\n \"id\": \"gid://shopify/Metafield/1069229037\",\n \"value\": \"New Mothers\"\n }\n ],\n \"id\": \"gid://shopify/Collection/79210309\"\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation updateCollectionMetafields($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n metafields(first: 3) {\n edges {\n node {\n id\n namespace\n key\n value\n }\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"metafields\": [\n {\n \"namespace\": \"my_field\",\n \"key\": \"subtitle\",\n \"type\": \"single_line_text_field\",\n \"value\": \"Bold Colors\"\n },\n {\n \"id\": \"gid://shopify/Metafield/1069229037\",\n \"value\": \"New Mothers\"\n }\n ],\n \"id\": \"gid://shopify/Collection/79210309\"\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 updateCollectionMetafields($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n metafields(first: 3) {\n edges {\n node {\n id\n namespace\n key\n value\n }\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"metafields\": [{\"namespace\"=>\"my_field\", \"key\"=>\"subtitle\", \"type\"=>\"single_line_text_field\", \"value\"=>\"Bold Colors\"}, {\"id\"=>\"gid://shopify/Metafield/1069229037\", \"value\"=>\"New Mothers\"}],\n \"id\": \"gid://shopify/Collection/79210309\"\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 updateCollectionMetafields($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n metafields(first: 3) {\n edges {\n node {\n id\n namespace\n key\n value\n }\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [\n \"metafields\" => [{\"namespace\"=>\"my_field\", \"key\"=>\"subtitle\", \"type\"=>\"single_line_text_field\", \"value\"=>\"Bold Colors\"}, {\"id\"=>\"gid://shopify/Metafield/1069229037\", \"value\"=>\"New Mothers\"}],\n \"id\" => \"gid://shopify/Collection/79210309\",\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 updateCollectionMetafields($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n metafields(first: 3) {\n edges {\n node {\n id\n namespace\n key\n value\n }\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"metafields\": [\n {\n \"namespace\": \"my_field\",\n \"key\": \"subtitle\",\n \"type\": \"single_line_text_field\",\n \"value\": \"Bold Colors\"\n },\n {\n \"id\": \"gid://shopify/Metafield/1069229037\",\n \"value\": \"New Mothers\"\n }\n ],\n \"id\": \"gid://shopify/Collection/79210309\"\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation updateCollectionMetafields($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n metafields(first: 3) {\n edges {\n node {\n id\n namespace\n key\n value\n }\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n}"
input: { "input": { "metafields": [ { "namespace": "my_field", "key": "subtitle", "type": "single_line_text_field", "value": "Bold Colors" }, { "id": "gid://shopify/Metafield/1069229037", "value": "New Mothers" } ], "id": "gid://shopify/Collection/79210309" } }
response: { "data": { "collectionUpdate": { "collection": { "id": "gid://shopify/Collection/79210309", "metafields": { "edges": [ { "node": { "id": "gid://shopify/Metafield/1069229037", "namespace": "my_fields", "key": "target_audience", "value": "New Mothers" } }, { "node": { "id": "gid://shopify/Metafield/1069229038", "namespace": "my_field", "key": "subtitle", "value": "Bold Colors" } } ] } }, "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 deleteCollectionImage { collectionUpdate(input: {id: \\\"gid://shopify/Collection/142458073\\\", image: null}) { collection { id title image { src altText } } userErrors { field message } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `mutation deleteCollectionImage {\n collectionUpdate(input: {id: \"gid://shopify/Collection/142458073\", image: null}) {\n collection {\n id\n title\n image {\n src\n altText\n }\n }\n userErrors {\n field\n message\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 deleteCollectionImage {\n collectionUpdate(input: {id: \"gid://shopify/Collection/142458073\", image: null}) {\n collection {\n id\n title\n image {\n src\n altText\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation deleteCollectionImage {\n collectionUpdate(input: {id: \"gid://shopify/Collection/142458073\", image: null}) {\n collection {\n id\n title\n image {\n src\n altText\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation deleteCollectionImage {\n collectionUpdate(input: {id: \"gid://shopify/Collection/142458073\", image: null}) {\n collection {\n id\n title\n image {\n src\n altText\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "mutation deleteCollectionImage {\n collectionUpdate(input: {id: \"gid://shopify/Collection/142458073\", image: null}) {\n collection {\n id\n title\n image {\n src\n altText\n }\n }\n userErrors {\n field\n message\n }\n }\n}"
input: null
response: { "data": { "collectionUpdate": { "collection": { "id": "gid://shopify/Collection/142458073", "title": "All snowboards", "image": null }, "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 updateCollectionHandle { collectionUpdate(input: {id: \\\"gid://shopify/Collection/142458073\\\", handle: \\\"my-most-popular-collection\\\"}) { collection { id title description handle } userErrors { field message } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `mutation updateCollectionHandle {\n collectionUpdate(input: {id: \"gid://shopify/Collection/142458073\", handle: \"my-most-popular-collection\"}) {\n collection {\n id\n title\n description\n handle\n }\n userErrors {\n field\n message\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 updateCollectionHandle {\n collectionUpdate(input: {id: \"gid://shopify/Collection/142458073\", handle: \"my-most-popular-collection\"}) {\n collection {\n id\n title\n description\n handle\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation updateCollectionHandle {\n collectionUpdate(input: {id: \"gid://shopify/Collection/142458073\", handle: \"my-most-popular-collection\"}) {\n collection {\n id\n title\n description\n handle\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation updateCollectionHandle {\n collectionUpdate(input: {id: \"gid://shopify/Collection/142458073\", handle: \"my-most-popular-collection\"}) {\n collection {\n id\n title\n description\n handle\n }\n userErrors {\n field\n message\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "mutation updateCollectionHandle {\n collectionUpdate(input: {id: \"gid://shopify/Collection/142458073\", handle: \"my-most-popular-collection\"}) {\n collection {\n id\n title\n description\n handle\n }\n userErrors {\n field\n message\n }\n }\n}"
input: null
response: { "data": { "collectionUpdate": { "collection": { "id": "gid://shopify/Collection/142458073", "title": "All snowboards", "description": "", "handle": "my-most-popular-collection" }, "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 updateCollectionRules($input: CollectionInput!) { collectionUpdate(input: $input) { collection { id title description handle ruleSet { rules { column relation condition } appliedDisjunctively } } job { id done } userErrors { field message } } }\",\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Collection/142458073\",\n \"ruleSet\": {\n \"rules\": [\n {\n \"column\": \"VARIANT_PRICE\",\n \"relation\": \"LESS_THAN\",\n \"condition\": \"200\"\n },\n {\n \"column\": \"TAG\",\n \"relation\": \"EQUALS\",\n \"condition\": \"board\"\n }\n ],\n \"appliedDisjunctively\": true\n }\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation updateCollectionRules($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n title\n description\n handle\n ruleSet {\n rules {\n column\n relation\n condition\n }\n appliedDisjunctively\n }\n }\n job {\n id\n done\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Collection/142458073\",\n \"ruleSet\": {\n \"rules\": [\n {\n \"column\": \"VARIANT_PRICE\",\n \"relation\": \"LESS_THAN\",\n \"condition\": \"200\"\n },\n {\n \"column\": \"TAG\",\n \"relation\": \"EQUALS\",\n \"condition\": \"board\"\n }\n ],\n \"appliedDisjunctively\": true\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 updateCollectionRules($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n title\n description\n handle\n ruleSet {\n rules {\n column\n relation\n condition\n }\n appliedDisjunctively\n }\n }\n job {\n id\n done\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"id\": \"gid://shopify/Collection/142458073\",\n \"ruleSet\": {\n \"rules\": [{\"column\"=>\"VARIANT_PRICE\", \"relation\"=>\"LESS_THAN\", \"condition\"=>\"200\"}, {\"column\"=>\"TAG\", \"relation\"=>\"EQUALS\", \"condition\"=>\"board\"}],\n \"appliedDisjunctively\": true\n }\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 updateCollectionRules($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n title\n description\n handle\n ruleSet {\n rules {\n column\n relation\n condition\n }\n appliedDisjunctively\n }\n }\n job {\n id\n done\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [\n \"id\" => \"gid://shopify/Collection/142458073\",\n \"ruleSet\" => [\n \"rules\" => [{\"column\"=>\"VARIANT_PRICE\", \"relation\"=>\"LESS_THAN\", \"condition\"=>\"200\"}, {\"column\"=>\"TAG\", \"relation\"=>\"EQUALS\", \"condition\"=>\"board\"}],\n \"appliedDisjunctively\" => true,\n ],\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 updateCollectionRules($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n title\n description\n handle\n ruleSet {\n rules {\n column\n relation\n condition\n }\n appliedDisjunctively\n }\n }\n job {\n id\n done\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"id\": \"gid://shopify/Collection/142458073\",\n \"ruleSet\": {\n \"rules\": [\n {\n \"column\": \"VARIANT_PRICE\",\n \"relation\": \"LESS_THAN\",\n \"condition\": \"200\"\n },\n {\n \"column\": \"TAG\",\n \"relation\": \"EQUALS\",\n \"condition\": \"board\"\n }\n ],\n \"appliedDisjunctively\": true\n }\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation updateCollectionRules($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n title\n description\n handle\n ruleSet {\n rules {\n column\n relation\n condition\n }\n appliedDisjunctively\n }\n }\n job {\n id\n done\n }\n userErrors {\n field\n message\n }\n }\n}"
input: { "input": { "id": "gid://shopify/Collection/142458073", "ruleSet": { "rules": [ { "column": "VARIANT_PRICE", "relation": "LESS_THAN", "condition": "200" }, { "column": "TAG", "relation": "EQUALS", "condition": "board" } ], "appliedDisjunctively": true } } }
response: { "data": { "collectionUpdate": { "collection": { "id": "gid://shopify/Collection/142458073", "title": "All snowboards", "description": "", "handle": "snowboards", "ruleSet": { "rules": [ { "column": "VARIANT_PRICE", "relation": "LESS_THAN", "condition": "200" }, { "column": "TAG", "relation": "EQUALS", "condition": "board" } ], "appliedDisjunctively": true } }, "job": { "id": "gid://shopify/Job/2f91478b-ff92-41dc-b9dd-04166fdd0420", "done": false }, "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 CollectionUpdate($input: CollectionInput!) { collectionUpdate(input: $input) { collection { id title description handle } userErrors { field message } } }\",\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Collection/142458073\",\n \"title\": \"Updated Collection Title\",\n \"handle\": \"updated-collection-handle\"\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation CollectionUpdate($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n title\n description\n handle\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Collection/142458073\",\n \"title\": \"Updated Collection Title\",\n \"handle\": \"updated-collection-handle\"\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 CollectionUpdate($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n title\n description\n handle\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"id\": \"gid://shopify/Collection/142458073\",\n \"title\": \"Updated Collection Title\",\n \"handle\": \"updated-collection-handle\"\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 CollectionUpdate($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n title\n description\n handle\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [\n \"id\" => \"gid://shopify/Collection/142458073\",\n \"title\" => \"Updated Collection Title\",\n \"handle\" => \"updated-collection-handle\",\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 CollectionUpdate($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n title\n description\n handle\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"id\": \"gid://shopify/Collection/142458073\",\n \"title\": \"Updated Collection Title\",\n \"handle\": \"updated-collection-handle\"\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation CollectionUpdate($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n title\n description\n handle\n }\n userErrors {\n field\n message\n }\n }\n}"
input: { "input": { "id": "gid://shopify/Collection/142458073", "title": "Updated Collection Title", "handle": "updated-collection-handle" } }
response: { "data": { "collectionUpdate": { "collection": { "id": "gid://shopify/Collection/142458073", "title": "Updated Collection Title", "description": "", "handle": "updated-collection-handle" }, "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 CollectionUpdate($input: CollectionInput!) { collectionUpdate(input: $input) { collection { id title description handle } userErrors { field message } } }\",\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Collection/142458073\",\n \"title\": \"Updated Smart Collection\",\n \"handle\": \"updated-smart-collection\"\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation CollectionUpdate($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n title\n description\n handle\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Collection/142458073\",\n \"title\": \"Updated Smart Collection\",\n \"handle\": \"updated-smart-collection\"\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 CollectionUpdate($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n title\n description\n handle\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"id\": \"gid://shopify/Collection/142458073\",\n \"title\": \"Updated Smart Collection\",\n \"handle\": \"updated-smart-collection\"\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 CollectionUpdate($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n title\n description\n handle\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [\n \"id\" => \"gid://shopify/Collection/142458073\",\n \"title\" => \"Updated Smart Collection\",\n \"handle\" => \"updated-smart-collection\",\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 CollectionUpdate($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n title\n description\n handle\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"id\": \"gid://shopify/Collection/142458073\",\n \"title\": \"Updated Smart Collection\",\n \"handle\": \"updated-smart-collection\"\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation CollectionUpdate($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n id\n title\n description\n handle\n }\n userErrors {\n field\n message\n }\n }\n}"
input: { "input": { "id": "gid://shopify/Collection/142458073", "title": "Updated Smart Collection", "handle": "updated-smart-collection" } }
response: { "data": { "collectionUpdate": { "collection": { "id": "gid://shopify/Collection/142458073", "title": "Updated Smart Collection", "description": "", "handle": "updated-smart-collection" }, "userErrors": [] } } }