collection

The collection object has the following attributes:

collection.all_types

Returns a list of all product types in a collection.

Input

{% for product_type in collection.all_types %}
  {{ product_type | link_to_type }}
{% endfor %}

Output

<a href="/collections/types?q=Accessories" title="accessories">Accessories</a>
<a href="/collections/types?q=Chairs" title="Chairs">Chairs</a>
<a href="/collections/types?q=Shoes" title="Shoes">Shoes</a>

collection.all_vendors

Returns a list of all product vendors in a collection.

Input

{% for product_vendor in collection.all_vendors %}
  {{ product_vendor | link_to_vendor }}
{% endfor %}

Output

<a href="/collections/vendors?q=Shopify" title="Shopify">Shopify</a>
<a href="/collections/vendors?q=Shirt+Company" title="Shirt Company">Shirt Company</a>
<a href="/collections/vendors?q=Montezuma" title="Montezuma">Montezuma</a>

collection.current_type

Returns the product type when filtering a collection by type. For example, you may be on a collection page filtered by a type query parameter via this URL: myshop.shopify.com/collections?types=shirts.

Input

{% if collection.current_type %}
    {{ collection.current_type }}
{% endif %}

Output

shirts

collection.current_vendor

Returns the vendor name when filtering a collection by vendor. For example, you may be on a collection page filtered by a vendor query parameter via this URL: myshop.shopify.com/collections/vendors?q=Shopify.

Input

{% if collection.current_vendor %}
    {{ collection.current_vendor }}
{% endif %}

Output

Shopify

collection.default_sort_by

Returns the sort order of the collection, which is set in the collection pages of the Admin.

#

The possible outputs are:

  • manual
  • best-selling
  • title-ascending
  • title-descending
  • price-ascending
  • price-descending
  • created-ascending
  • created-descending

collection.description

Returns the description of the collection.

collection.handle

Returns the handle of a collection.

collection.id

Returns the id of the collection.

collection.image

Returns the collection image. Use the collection_img_url filter to link it to the image file on the Shopify CDN.

Input

{{ collection.image | collection_img_url: 'medium' }}

Output

//cdn.shopify.com/s/files/1/0087/0462/collections/collection-image_medium.png?v=1337103726

collection.image.src

Returns the relative URL to the collection image.

Input

{{ collection.image.src | collection_img_url: 'medium' }}

Output

//cdn.shopify.com/s/files/1/0087/0462/collections/summer_collection_medium.png?v=1334084726

collection.next_product

Returns the URL of the next product in the collection. Returns nil if there is no next product.

This output can be used on the product page to output "next" and "previous" links on the product.liquid template. For more information, see How to Navigate within a Collection.

collection.previous_product

Returns the URL of the previous product in the collection. Returns nil if there is no previous product.

This output can be used on the product page to output "next" and "previous" links on the product.liquid template. For more information, see How to Navigate within a Collection.

collection.products

Returns all of the products inside a collection. Note that there is a limit of 50 products that can be shown per page. Use the pagination tag to control how many products are shown per page.

collection.products_count

Returns the number of products in a collection.

Input

{{ collection.all_products_count }} {{ collection.all_products_count | pluralize: 'Item', 'Items' }} total

Output

24 Items

collection.template_suffix

Returns the name of the custom collection template assigned to the collection, without the collection. prefix or the .liquid suffix. Returns nil if a custom template is not assigned to the collection.

Input

{{ collection.template_suffix }}

Output

no-price

collection.title

Returns the title of the collection.

Input

<h1>{{ collection.title }}</h1>

Output

Frontpage

collection.tags

Returns all tags of all products in a collection.

collection.url

Returns the URL of the collection.

Return to top

Ready to put what you've learned into action?

Build an online store with Shopify. Try it free.

Experience the future of retail now.

Shopify Point of Sale. Try it free.