Version: 2024-10
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 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 = <<[\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-10/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/1069229259\",\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/1069229259\",\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/1069229259\", \"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 = <<[\n \"metafields\" => [{\"namespace\"=>\"my_field\", \"key\"=>\"subtitle\", \"type\"=>\"single_line_text_field\", \"value\"=>\"Bold Colors\"}, {\"id\"=>\"gid://shopify/Metafield/1069229259\", \"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/1069229259\",\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/1069229259", "value": "New Mothers" } ], "id": "gid://shopify/Collection/79210309" } }
response: { "data": { "collectionUpdate": { "collection": { "id": "gid://shopify/Collection/79210309", "metafields": { "edges": [ { "node": { "id": "gid://shopify/Metafield/1069229259", "namespace": "my_fields", "key": "target_audience", "value": "New Mothers" } }, { "node": { "id": "gid://shopify/Metafield/1069229260", "namespace": "my_field", "key": "subtitle", "value": "Bold Colors" } } ] } }, "userErrors": [] } } }
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 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([\"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-10/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([\"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-10/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 = <<[\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/11620af1-410d-4a40-a940-b75a1f40732d", "done": false }, "userErrors": [] } } }