# collectionUpdate - admin - MUTATION
Version: 2024-07

## Description
Updates a collection.

### Access Scopes
`write_products` 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.


## Arguments
* [input](/docs/api/admin/2024-07/input-objects/CollectionInput): CollectionInput! - The updated properties for the collection.


## Returns
* [collection](/docs/api/admin/2024-07/objects/Collection): Collection The updated collection.
* [job](/docs/api/admin/2024-07/objects/Job): Job The asynchronous job updating the products based on the new rule set.
* [userErrors](/docs/api/admin/2024-07/objects/UserError): UserError! The list of errors that occurred from executing the mutation.


## Examples
### Apply a rule on a manual collection
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-07/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" 
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}"
#### Graphql Input
{
  "input": {
    "id": "gid://shopify/Collection/442946009",
    "ruleSet": {
      "rules": [
        {
          "column": "IS_PRICE_REDUCED",
          "relation": "IS_NOT_SET",
          "condition": ""
        }
      ],
      "appliedDisjunctively": true
    }
  }
}
#### Graphql Response
{
  "data": {
    "collectionUpdate": {
      "collection": null,
      "userErrors": [
        {
          "field": [
            "id"
          ],
          "message": "Cannot update rule set of a custom collection"
        }
      ]
    }
  }
}

### Create a new metafield and update another on an existing collection
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-07/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" 
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}"
#### Graphql 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"
  }
}
#### Graphql 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": []
    }
  }
}

### Delete the collection's image
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-07/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" 
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}"
#### Graphql Input
null
#### Graphql Response
{
  "data": {
    "collectionUpdate": {
      "collection": {
        "id": "gid://shopify/Collection/142458073",
        "title": "All snowboards",
        "image": null
      },
      "userErrors": []
    }
  }
}

### Update the collection's handle
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-07/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" 
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}"
#### Graphql Input
null
#### Graphql Response
{
  "data": {
    "collectionUpdate": {
      "collection": {
        "id": "gid://shopify/Collection/142458073",
        "title": "All snowboards",
        "description": "",
        "handle": "my-most-popular-collection"
      },
      "userErrors": []
    }
  }
}

### Update the collection's rule set
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-07/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" 
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}"
#### Graphql 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
    }
  }
}
#### Graphql 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": []
    }
  }
}

### Updates an existing custom collection
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-07/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" 
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}"
#### Graphql Input
{
  "input": {
    "id": "gid://shopify/Collection/142458073",
    "title": "Updated Collection Title",
    "handle": "updated-collection-handle"
  }
}
#### Graphql Response
{
  "data": {
    "collectionUpdate": {
      "collection": {
        "id": "gid://shopify/Collection/142458073",
        "title": "Updated Collection Title",
        "description": "",
        "handle": "updated-collection-handle"
      },
      "userErrors": []
    }
  }
}

### Updates an existing smart collection
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-07/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" 
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}"
#### Graphql Input
{
  "input": {
    "id": "gid://shopify/Collection/142458073",
    "title": "Updated Smart Collection",
    "handle": "updated-smart-collection"
  }
}
#### Graphql Response
{
  "data": {
    "collectionUpdate": {
      "collection": {
        "id": "gid://shopify/Collection/142458073",
        "title": "Updated Smart Collection",
        "description": "",
        "handle": "updated-smart-collection"
      },
      "userErrors": []
    }
  }
}