---
title: "collection"
description: "通过其独特属性之一获取特定分类"
doc_type: graphql
doc_category: storefront
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/queries/collection'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/queries/collection.md'
---
# collection

通过其独特属性之一获取特定分类

- **API Version:** v20270301
- **API Type:** Storefront
- **API Protocol:** GraphQL
- **Operation Type:** Query

## Type Signature

`Collection`

## Arguments

* `handle`

  [String](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common/scalars/string.md)

  分类handle，店铺内保证唯一

* `id`

  [ID](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common/scalars/id.md)

  全局唯一的分类ID

## Returns

* `banner`

  [Image](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common-objects/objects/image.md)

  banner

* `createdAt`

  [Date!](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common/scalars/date.md)

  创建时间

* `descriptionHtml`

  [String](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common/scalars/string.md)

  带HTML标签的分类描述

* `handle`

  [String](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common/scalars/string.md)

  分类handle

* `id`

  [ID!](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common/scalars/id.md)

  分类ID

* `image`

  [Image](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common-objects/objects/image.md)

  分类图片

* `metafield`

  [Metafield](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common-objects/objects/metafield.md)

  关联在分类上的元字段

* `metafields`

  [[Metafield]](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common-objects/objects/metafield.md)

  关联在分类上的一组元字段

* `onlineStoreUrl`

  [String](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common/scalars/string.md)

  在当前店铺内的URL(包含域名)

* `products`

  [ProductConnection](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/objects/product-connection.md)

  商品集合

* `~~productsCount~~`

  [Int](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common/scalars/int.md)

  该分类下有多少个商品 [Deprecated]

* `~~sortOrder~~`

  [String](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common/scalars/string.md)

  分类排序 [Deprecated]

* `templatePath`

  [String](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common/scalars/string.md)

  模块路径

* `title`

  [String](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common/scalars/string.md)

  分类标题

* `updatedAt`

  [Date](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common/scalars/date.md)

  更新时间

## Code Example

```graphql
 {
	collection(handle, id ) 
		 {
			# Collection fields
		}
}
```

## Error Handling

关于更多通用错误码说明，参考：[状态码和错误码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/storefront-api/overview.md#status-and-error-codes)。

