---
title: "collection"

doc_type: static
doc_category: static
doc_version: v20260901
source_url:
  html: 'https://developer.shopline.com/docs/handlebars/objects/collection'
  md: 'https://developer.shopline.com/docs/handlebars/objects/collection.md'
---


# collection

<div className="code-flex">
  <div>
    <ObjectSummary>A collection in a store.</ObjectSummary>
    #### Properties
    <ObjectProperty name="all_products_count" types={["number"]}>
      <ObjectSummary>
        The total number of products in a collection.

        This includes products that have been filtered out of the current view.

        > **Tip**
>
> To display the number of products in a filtered collection, use [collection.products_count](https://developer.shopline.com/docs/handlebars/objects/collection.md#products_count).
      </ObjectSummary>
    </ObjectProperty>
    <ObjectProperty name="all_tags" types={["number"]}>
      <ObjectSummary>
        All of the tags applied to the products in the collection.

        This includes tags for products that have been filtered out of the current view. A maximum of 1,000 tags can be returned.
        > **Tip**
>
> To display the tags that are currently applied, use [collection.tags](https://developer.shopline.com/docs/handlebars/objects/collection.md#tags).
      </ObjectSummary>
    </ObjectProperty>
    <ObjectProperty name="all_types" types={["array of string"]}>
      <ObjectSummary>
        All of the product types in a collection.
      </ObjectSummary>
    </ObjectProperty>
    <ObjectProperty name="all_vendors" types={["array of string"]}>
      <ObjectSummary>
        All of the product vendors in a collection.
      </ObjectSummary>
    </ObjectProperty>
    <ObjectProperty name="current_type" types={["string"]}>
      <ObjectSummary>
        The product type on a product type collection page.

        You can query for products of a certain type at the `/collections/types` URL with a query parameter in the format of `?q=[type]`, where `[type]` is your desired product type.
        > **Tip**
>
> The query value is case-insensitive, so `shirts` is equivalent to `Shirts` or `SHIRTS`.
      </ObjectSummary>
    </ObjectProperty>
    <ObjectProperty name="current_vendor" types={["string"]}>
      <ObjectSummary>
        The vendor name on a vendor collection page.

        You can query for products from a certain vendor at the `/collections/vendors` URL with a query parameter in the format of `?q=[vendor]`, where `[vendor]` is your desired product vendor.
        > **Tip**
>
> The query value is case-insensitive, so `apparelco` is equivalent to `ApparelCo` or `APPARELCO`.
      </ObjectSummary>
    </ObjectProperty>
    <ObjectProperty name="default_sort_by" types={["string from a set of values"]}>
      <ObjectSummary>
        The default sort order of the collection.

        This is set on the collection's page in the Shopline admin.
      </ObjectSummary>
    </ObjectProperty>
    <ObjectProperty name="description" types={["string"]}>
      <ObjectSummary>
        The description of the collection.
      </ObjectSummary>
    </ObjectProperty>
    <ObjectProperty name="featured_image" types={[<Mdx>[image](https://developer.shopline.com/docs/handlebars/objects/image.md)</Mdx>]}>
      <ObjectSummary>
        The featured image for the collection.

        The default is the collection cover image. If this image isn't available, then Shopline falls back to the featured image of the first product in the collection. If the first product in the collection doesn't have a featured image, then `null` is returned.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="filters" types={[<Mdx>array of [filter](https://developer.shopline.com/docs/handlebars/objects/filter.md)</Mdx>]}>
      <ObjectSummary>
       The storefront filters that have been set up on the collection.

       Only filters relevant to the current collection are returned. Filters will be empty for collections that contain over 5000 products.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="handle" types={["string"]}>
      <ObjectSummary>
        The [handle](https://developer.shopline.com/docs/handlebars/objects/handle.md) of the collection.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="id" types={["string"]}>
      <ObjectSummary>
        The ID of the collection.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="image" types={[<Mdx>[image](https://developer.shopline.com/docs/handlebars/objects/image.md)</Mdx>]}>
      <ObjectSummary>
        The cover image for the collection.

        This cover image is added on the collection's page in the Shopline admin.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="products" types={[<Mdx>array of [product](https://developer.shopline.com/docs/handlebars/objects/product.md)</Mdx>]}>
      <ObjectSummary>
        All of the products in the collection.
        > **Tip**
>
> Use the [paginate](https://developer.shopline.com/docs/handlebars/helpers/iteration/paginate.md) helper to choose how many products to show per page, up to a limit of 50.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="products_count" types={["number"]}>
      <ObjectSummary>
        The total number of products in the current view of the collection.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="published_at" types={["string"]}>
      <ObjectSummary>
        A timestamp for when the collection was published.
        > **Tip**
>
> Use the [`date helper`](https://developer.shopline.com/docs/handlebars/helpers/format/date.md) to format the timestamp.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="sort_by" types={["string"]}>
      <ObjectSummary>
        The sort order applied to the collection by the sort_by URL parameter.

        If there's no sort_by URL parameter, then the value is `null`.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="sort_options" types={[<Mdx>array of sort_option</Mdx>]}>
      <ObjectSummary>
        The available sorting options for the collection.
      </ObjectSummary>

      <Example data={['collection.sort_options', 'collection.sort_by', 'collection.default_sort_by']} layout="vertical">

        ```handlebars

        {{ assign 'sort_by' (default collection.sort_by collection.default_sort_by) }}

        <select>
        {{#each collection.sort_options as |option| }}
          <option
            value="{{ option.value }}"
            {{#if option.value '==' sort_by }}
              selected="selected"
            {{/if}}
          >
            {{ option.name }}
          </option>
        {{/each}}
        </select>

        ```
      </Example>
    </ObjectProperty>

    <ObjectProperty name="tags" types={["array of string"]}>
      <ObjectSummary>
        The tags that are currently applied to the collection.

        This doesn't include tags for products that have been filtered out of the current view. Returns `empty array` if no tags have been applied, or all products with tags have been filtered out of the current view.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="title" types={["string"]}>
      <ObjectSummary>
        The title of the collection.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="url" types={["string"]}>
      <ObjectSummary>
        The relative URL of the collection.
      </ObjectSummary>
    </ObjectProperty>
  </div>

  <div>
    <ObjectAccess
      object="collection"
      global={false}
      templates={[
        { name: 'collection' },
      ]}
    />
  </div>
</div>
