---
title: "Collection"
description: >
  Represents a set of products which can be shown by collection in online stores and other channels for sales, so that customers can easily discover them. For instance, a sporting goods store might introduce different collections of running apparel, shoes, and accessories.
doc_type: graphql
doc_category: adminGraphQL
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/admin-graph-ql-api/products-and-collections/objects/collection'
  md: 'https://developer.shopline.com/docs/admin-graph-ql-api/products-and-collections/objects/collection.md'
---
# Collection

Represents a set of products which can be shown by collection in online stores and other channels for sales, so that customers can easily discover them. For instance, a sporting goods store might introduce different collections of running apparel, shoes, and accessories.

- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** GraphQL
- **Operation Type:** Object

## Type Signature

`Collection`

## Fields

* `banner`

  [Image](https://developer.shopline.com/docs/admin-graph-ql-api/common-objects/objects/image.md)

  The banner associated with the collection.

* `descriptionHtml`

  [String](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  The collection's description, which includes any tags of HTML and formatting. The content of description is typically shown to customers according to the theme.

* `handle`

  [String](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  A unique string used to identify the collection. If the handle is not specified during the collection creation process, it will be automatically generated based on the collection's title.

* `hasProduct`

  [Boolean](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/boolean.md)

  Whether the specified product is bound to the current collection.

* `id`

  [ID](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/id.md)

  Globally unique collection ID.

* `image`

  [Image](https://developer.shopline.com/docs/admin-graph-ql-api/common-objects/objects/image.md)

  The cover image for collection

* `products`

  [ProductConnection](https://developer.shopline.com/docs/admin-graph-ql-api/products-and-collections/objects/product-connection.md)

  The list of products in the current collection.

* `productsCount`

  [Int](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/int.md)

  The number of products in the collection.

* `resourcePublicationsV2`

  [ResourcePublicationV2Connection](https://developer.shopline.com/docs/admin-graph-ql-api/apps/objects/resource-publication-v2-connection.md)

  The resources that have been published or are ready to be published. Currently, querying the collection ResoursePublicationV2 is not supported.

* `ruleSet`

  [CollectionRuleSet](https://developer.shopline.com/docs/admin-graph-ql-api/products-and-collections/objects/collection-rule-set.md)

  The rules that specify whether a product is included in a smart collection.

* `seo`

  [Seo](https://developer.shopline.com/docs/admin-graph-ql-api/common-objects/objects/seo.md)

  Seo information of the collection.

* `sortOrder`

  [CollectionSortOrder](https://developer.shopline.com/docs/admin-graph-ql-api/products-and-collections/enums/collection-sort-order.md)

  By default, the display order of products within the category in the SHOPLINE backend and sales channels like online stores.

* `templateSuffix`

  [String](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  The theme template used for viewing collection in the store.

* `title`

  [String](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  The collection's name, which is showed in the Shopline backend and typically shown in sales channels, for example, online stores.

* `updatedAt`

  [Date](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/date.md)

  The collection's modification time in ISO 8601 format.

## Schema Definition

```graphql
type Collection { 
	banner: Image
	descriptionHtml: String
	handle: String
	hasProduct(id,ID!): Boolean
	id: ID
	image: Image
	products(before,String,reverse,Boolean,sortkey,ProductCollectionSortKeys,first,Int,after,String,last,Int): ProductConnection
	productsCount: Int
	resourcePublicationsV2(onlyPublished,Boolean,catalogType,CatalogType,first,Int,last,Int,before,String,after,String,reverse,Boolean): ResourcePublicationV2Connection
	ruleSet: CollectionRuleSet
	seo: Seo
	sortOrder: CollectionSortOrder
	templateSuffix: String
	title: String
	updatedAt: Date 
}
```

## Field from

* [CollectionUpdatePayload](https://developer.shopline.com/docs/admin-graph-ql-api/products-and-collections/objects/collection-update-payload.md).collection

  The updated collection.	The collection that has been updated.

* [Query](https://developer.shopline.com/docs/admin-graph-ql-api/products-and-collections/queries/collection.md).collection

  使用 ID 检索 Collection 

* [Query](https://developer.shopline.com/docs/admin-graph-ql-api/products-and-collections/queries/collection-by-handle.md).collectionByHandle

  根据分类的handle查询分类信息 

* [CollectionCreatePayload](https://developer.shopline.com/docs/admin-graph-ql-api/products-and-collections/objects/collection-create-payload.md).collection

  The created collection.

* [CollectionAddProductsPayload](https://developer.shopline.com/docs/admin-graph-ql-api/products-and-collections/objects/collection-add-products-payload.md).collection

  Updated collection. If an error occurs, returns null.

* [CollectionConnection](https://developer.shopline.com/docs/admin-graph-ql-api/products-and-collections/objects/collection-connection.md).nodes

  List of nodes contained within a CollectionEdge.

* [CollectionEdge](https://developer.shopline.com/docs/admin-graph-ql-api/products-and-collections/objects/collection-edge.md).node

  Node of the Collection.

## Error Handling

For detailed information about common codes, see [Status and error codes](https://developer.shopline.com/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md#status-and-error-codes).

