collection Updatemutation
mutation
2024-10latest
Requires write
access scope. Also: The app must have access to the input fields used to update the collection. Further, the store must not be on the Starter or Retail plans and user must have a permission to update collection.
Updates a collection.
Arguments
The updated properties for the collection.
Was this section helpful?
CollectionUpdatePayload returns
The updated collection.
The asynchronous job updating the products based on the new rule set.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Code examples for MUTATION: collectionUpdate
Query Reference for MUTATION: collectionUpdate
"mutation collectionUpdate($input: CollectionInput!) {\n collectionUpdate(input: $input) {\n collection {\n # Collection fields\n }\n job {\n # Job fields\n }\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: collectionUpdate
"{\n \"input\": {\n \"descriptionHtml\": \"<your-descriptionHtml>\",\n \"handle\": \"<your-handle>\",\n \"id\": \"gid://shopify/<objectName>/10079785100\",\n \"image\": {\n \"altText\": \"<your-altText>\",\n \"id\": \"gid://shopify/<objectName>/10079785100\",\n \"src\": \"<your-src>\"\n },\n \"metafields\": [\n {\n \"description\": \"<your-description>\",\n \"id\": \"gid://shopify/<objectName>/10079785100\",\n \"key\": \"<your-key>\",\n \"namespace\": \"<your-namespace>\",\n \"type\": \"<your-type>\",\n \"value\": \"<your-value>\"\n }\n ],\n \"products\": [\n \"gid://shopify/<objectName>/10079785100\"\n ],\n \"redirectNewHandle\": true,\n \"ruleSet\": {\n \"appliedDisjunctively\": true,\n \"rules\": [\n {\n \"column\": \"IS_PRICE_REDUCED\",\n \"condition\": \"<your-condition>\",\n \"conditionObjectId\": \"gid://shopify/<objectName>/10079785100\",\n \"relation\": \"CONTAINS\"\n }\n ]\n },\n \"seo\": {\n \"description\": \"<your-description>\",\n \"title\": \"<your-title>\"\n },\n \"sortOrder\": \"ALPHA_ASC\",\n \"templateSuffix\": \"<your-templateSuffix>\",\n \"title\": \"<your-title>\"\n }\n}"
Schema Reference for MUTATION: collectionUpdate
"input CollectionInput {\n descriptionHtml: String\n handle: String\n id: ID\n image: ImageInput\n metafields: [MetafieldInput!]\n privateMetafields: [PrivateMetafieldInput!]\n products: [ID!]\n publications: [CollectionPublicationInput!]\n redirectNewHandle: Boolean\n ruleSet: CollectionRuleSetInput\n seo: SEOInput\n sortOrder: CollectionSortOrder\n templateSuffix: String\n title: String\n}\n\ninput ImageInput {\n altText: String\n id: ID\n src: String\n}\n\ninput MetafieldInput {\n description: String\n id: ID\n key: String\n namespace: String\n type: String\n value: String\n}\n\ninput PrivateMetafieldInput {\n key: String!\n namespace: String!\n owner: ID\n valueInput: PrivateMetafieldValueInput!\n}\n\ninput CollectionPublicationInput {\n channelHandle: String\n channelId: ID\n publicationId: ID\n}\n\ninput CollectionRuleSetInput {\n appliedDisjunctively: Boolean!\n rules: [CollectionRuleInput!]\n}\n\ninput SEOInput {\n description: String\n title: String\n}\n"
Display Examples for MUTATION: collectionUpdate
[ { "example": { "type_name": "collectionupdate", "title": "Apply a rule on a manual collection", "description": "Trying to apply a rule on a manual collection returns an error.\n", "query_string": "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}", "variables": { "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" } ] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/merchandising/test/unit/graph_api/admin/mutations/collection_update_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 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", "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", "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", "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", "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" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "input", "description": "The updated properties for the collection.", "type": { "kind": "INPUT_OBJECT", "name": "CollectionInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "CollectionInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "input", "argValue": " {\"id\":\"gid://shopify/Collection/442946009\",\"ruleSet\":{\"rules\":[{\"column\":\"IS_PRICE_REDUCED\",\"relation\":\"IS_NOT_SET\",\"condition\":\"\"}],\"appliedDisjunctively\":true}}", "typeKind": "MUTATION" } ] }, { "example": { "type_name": "collectionupdate", "title": "Create a new metafield and update another on an existing collection", "description": "Create a new metafield `my_field.subtitle` and update an\nexisting metafield `my_fields.target_audience` on a specific\ncollection.\n\n\nAlternatively, refer to the\n[metafieldsSet](https://shopify.dev/api/admin-graphql/latest/mutations/metafieldsset) mutation\nto create and/or update metafields on collection resources.\n", "query_string": "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}", "variables": { "input": { "metafields": [ { "namespace": "my_field", "key": "subtitle", "type": "single_line_text_field", "value": "Bold Colors" }, { "id": "gid://shopify/Metafield/1069229006", "value": "New Mothers" } ], "id": "gid://shopify/Collection/79210309" } }, "response": { "data": { "collectionUpdate": { "collection": { "id": "gid://shopify/Collection/79210309", "metafields": { "edges": [ { "node": { "id": "gid://shopify/Metafield/1069229006", "namespace": "my_fields", "key": "target_audience", "value": "New Mothers" } }, { "node": { "id": "gid://shopify/Metafield/1069229007", "namespace": "my_field", "key": "subtitle", "value": "Bold Colors" } } ] } }, "userErrors": [] } } }, "api_name": "admin", "location": "/components/merchandising/test/unit/graph_api/admin/mutations/collection_update_test.rb", "minimum_api_version": null, "maximum_api_version": null, "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/1069229006\",\n \"value\": \"New Mothers\"\n }\n ],\n \"id\": \"gid://shopify/Collection/79210309\"\n }\n }\n}'\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/1069229006\",\n \"value\": \"New Mothers\"\n }\n ],\n \"id\": \"gid://shopify/Collection/79210309\"\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 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/1069229006\", \"value\"=>\"New Mothers\"}],\n \"id\": \"gid://shopify/Collection/79210309\"\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 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/1069229006\",\n \"value\": \"New Mothers\"\n }\n ],\n \"id\": \"gid://shopify/Collection/79210309\"\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 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/1069229006\", \"value\"=>\"New Mothers\"}],\n \"id\" => \"gid://shopify/Collection/79210309\",\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "input", "description": "The updated properties for the collection.", "type": { "kind": "INPUT_OBJECT", "name": "CollectionInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "CollectionInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "input", "argValue": " {\"metafields\":[{\"namespace\":\"my_field\",\"key\":\"subtitle\",\"type\":\"single_line_text_field\",\"value\":\"Bold Colors\"},{\"id\":\"gid://shopify/Metafield/1069229006\",\"value\":\"New Mothers\"}],\"id\":\"gid://shopify/Collection/79210309\"}", "typeKind": "MUTATION" } ] }, { "example": { "type_name": "collectionupdate", "title": "Delete the collection's image", "query_string": "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}", "response": { "data": { "collectionUpdate": { "collection": { "id": "gid://shopify/Collection/142458073", "title": "All snowboards", "image": null }, "userErrors": [] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/merchandising/test/unit/graph_api/admin/mutations/collection_update_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 deleteCollectionImage { collectionUpdate(input: {id: \\\"gid://shopify/Collection/142458073\\\", image: null}) { collection { id title image { src altText } } userErrors { field message } } }\"\n}'\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", "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", "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", "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" }, "titleStringKey": "variables", "inputVariableEntries": [] }, { "example": { "type_name": "collectionupdate", "title": "Update the collection's handle", "query_string": "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}", "response": { "data": { "collectionUpdate": { "collection": { "id": "gid://shopify/Collection/142458073", "title": "All snowboards", "description": "", "handle": "my-most-popular-collection" }, "userErrors": [] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/merchandising/test/unit/graph_api/admin/mutations/collection_update_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 updateCollectionHandle { collectionUpdate(input: {id: \\\"gid://shopify/Collection/142458073\\\", handle: \\\"my-most-popular-collection\\\"}) { collection { id title description handle } userErrors { field message } } }\"\n}'\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", "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", "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", "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" }, "titleStringKey": "variables", "inputVariableEntries": [] }, { "example": { "type_name": "collectionupdate", "title": "Update the collection's rule set", "description": "If a collection with the specified ID doesn't exist, then the mutation returns an error.\n", "query_string": "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}", "variables": { "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/21ea21da-c35e-4693-b636-1124e3c0fdd2", "done": false }, "userErrors": [] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/merchandising/test/unit/graph_api/admin/mutations/collection_update_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 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", "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", "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", "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", "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" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "input", "description": "The updated properties for the collection.", "type": { "kind": "INPUT_OBJECT", "name": "CollectionInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "CollectionInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "input", "argValue": " {\"id\":\"gid://shopify/Collection/142458073\",\"ruleSet\":{\"rules\":[{\"column\":\"VARIANT_PRICE\",\"relation\":\"LESS_THAN\",\"condition\":\"200\"},{\"column\":\"TAG\",\"relation\":\"EQUALS\",\"condition\":\"board\"}],\"appliedDisjunctively\":true}}", "typeKind": "MUTATION" } ] } ]