The collection object
collection object has the following attributes:
Returns the number of products in a collection.
collection.all_products_count will return the total number of products even when the collection view is filtered.
collection.products_count returns all tags for a collection for the current view. For example, if a collection is filtered by tag,
collection.products_count returns the number of products that match the current filter.
Returns a list of all product tags in a collection.
collection.all_tags will return the full list of tags even when the collection view is filtered.
collection.all_tags will return at most 1,000 tags.
collection.tags returns all tags for a collection for the current view. For example, if a collection is filtered by tag,
collection.tags returns only the tags that match the current filter.
Returns a list of all product types in a collection.
Returns a list of all product vendors in a collection.
Returns the product type on a
/collections/types?q=TYPE collection page. For example, an automatic "Shirts" collection lists all products of type "Shirts" in the store:
Returns the product vendor on a
/collections/vendors?q=VENDOR collection page. For example, an automatic "ApparelCo" collection lists all products with the vendor "ApparelCo" in the store:
Returns the sort order of the collection set in the collection's page in your Shopify admin.
The possible sort orders are:
Returns the description of the collection.
Returns the collection's handle.
Returns the ID number of the collection.
Returns the image of the collection.
Returns the next product in the collection. Returns
nil if there is no next product.
Returns the previous product in the collection. Returns
nil if there is no previous product.
Returns all of the products in a collection. You can show a maximum of 50 products per page.
Use the paginate tag to choose how many products are shown per page.
Returns the number of products in a collection that match the current view. For example, if you are viewing a collection filtered by tag,
collection.products_count will return the number of products that match the chosen tag.
Returns the date and time when the collection was published. You can set this information on the collection's page in your Shopify admin by the Set publish date calendar icon.
You can use a date filter to format the date.
Returns the sort order applied to the collection by the
sort_by URL parameter. When there is no
sort_by URL parameter, the value is
Returns an array of sorting options for the collection.
The customer-facing label for the sort option.
You can change the sort option labels shown to customers in the language editor.
The value of the sort option to be assigned to the
sort_by property in a form submission.
You can identify the current sort option using collection.sort_by.
Returns the name of the custom collection template assigned to the collection, without the
collection. prefix or the
.liquid extension. Returns
nil if a custom template is not assigned to the collection.
Returns the title of the collection.
Returns the tags of products in a collection that match the current view. For example, if you are viewing a collection filtered by tag,
collection.tags will return the tags for the products that match the current filter.
Returns the URL of the collection.