collection

A collection in a store.

Properties

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.

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.

All of the product types in a collection.

All of the product vendors in a collection.

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.

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.

The default sort order of the collection.

This is set on the collection's page in the Shopline admin.

The description of the collection.

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.

The handle of the collection.

The ID of the collection.

The cover image for the collection.

This cover image is added on the collection's page in the Shopline admin.

All of the products in the collection.

Tip

Use the paginate helper to choose how many products to show per page, up to a limit of 50.

The total number of products in the current view of the collection.

A timestamp for when the collection was published.

Tip

Use the date helper to format the timestamp.

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.

The available sorting options for the collection.


{{ 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>


Output

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.

The title of the collection.

The relative URL of the collection.

Directly accessible in
  • collection
collection
Was this article helpful to you?

Error loading component.

Error loading component.