collectionUpdate mutation
Updates a collection.
Required access
write_products access scope.
On this page
Interactive example
This is an example mutation query. Use the embedded interactive tool below to edit the query.
Hint: use Ctrl + Space for autocompleting fields.
mutation collectionUpdate($input: CollectionInput!) { collectionUpdate(input: $input) {} } { “input”: {} }
<font style="color:#1F61A0;">collection</font> <font style="color:#555555;">{</font><font style="color:#1F61A0;">id</font><font style="color:#555555;">}</font><font style="color:#1F61A0;">job</font> <font style="color:#555555;">{</font><font style="color:#1F61A0;">id</font><font style="color:#555555;">}</font><font style="color:#1F61A0;">userErrors</font> <font style="color:#555555;">{</font><font style="color:#1F61A0;">field</font><font style="color:#1F61A0;">message</font><font style="color:#555555;">}</font>
Arguments
| Argument | Description |
|---|---|
input( [CollectionInput!](https://shopify.dev/docs/admin-api/graphql/reference/products-and-collections/collectioninput)) REQUIRED |
The updated properties for the collection. |
CollectionInput fields
- descriptionHtml (
[String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
The description of the collection, in HTML format. - handle (
[String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
A unique human-friendly string for the collection. Automatically generated from the collection’s title. - id (
[ID](https://shopify.dev/docs/admin-api/graphql/reference/scalar#id-2021-01))
Specifies the collection to update or create a new collection if absent. - image (
[ImageInput](https://shopify.dev/docs/admin-api/graphql/reference/common-objects/imageinput))
The image associated with the collection. - metafields (
[[MetafieldInput!]](https://shopify.dev/docs/admin-api/graphql/reference/metafields/metafieldinput))
The metafields to associate with this collection. - privateMetafields (
[[PrivateMetafieldInput!]](https://shopify.dev/docs/admin-api/graphql/reference/metafields/privatemetafieldinput))
The private metafields to associated with this product. - products (
[[ID!]](https://shopify.dev/docs/admin-api/graphql/reference/scalar#id-2021-01))
Initial list of collection products. Only valid withproductCreateand without rules. - publications (
[[CollectionPublicationInput!]](https://shopify.dev/docs/admin-api/graphql/reference/products-and-collections/collectionpublicationinput))
Initial list of collection publications. Only valid withproductCreate. This argument is deprecated: Use PublishablePublish instead. - redirectNewHandle (
[Boolean](https://shopify.dev/docs/admin-api/graphql/reference/scalar#boolean-2021-01))
Indicates whether a redirect is required after a new handle has been provided. If true, then the old handle is redirected to the new one automatically. - ruleSet (
[CollectionRuleSetInput](https://shopify.dev/docs/admin-api/graphql/reference/products-and-collections/collectionrulesetinput))
The rules used to assign products to the collection. - seo (
[SEOInput](https://shopify.dev/docs/admin-api/graphql/reference/online-store/seoinput))
SEO information for the collection. - sortOrder (
[CollectionSortOrder](https://shopify.dev/docs/admin-api/graphql/reference/products-and-collections/collectionsortorder))
The order in which the collection’s products are sorted. - templateSuffix (
[String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
The theme template used when viewing the collection in a store. - title (
[String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
Required for creating a new collection.
Return fields
- collection (
[Collection](https://shopify.dev/docs/admin-api/graphql/reference/products-and-collections/collection))
The updated collection. - job (
[Job](https://shopify.dev/docs/admin-api/graphql/reference/common-objects/job))
The asynchronous job updating the products based on the new rule set. - userErrors (
[[UserError!]!](https://shopify.dev/docs/admin-api/graphql/reference/usererror))
List of errors that occurred executing the mutation.
