collection

The collection object has the following attributes:

collection.products_count

Returns the total number of products in a collection, even when the collection is filtered.

collection.current_type

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. For example, the following URL would return products of type Shirts:

collection.current_vendor

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.

collection.default_sort_by

Returns the default sort order of the collection, which is set in the collection's page of the Shoplazza admin.

The possible sort orders 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.id

Returns the ID number of the collection.

collection.image

Returns the collection's image, which is set in the collection's page of the Shoplazza admin.

collection.products

Returns an array of all the products in a collection.

collection.sort_by

Returns the sort order applied to the collection by the sort_by URL parameter. If there is no sort_by URL parameter, then the value is nil.

collection.title

Returns the title of the collection.

collection.tags

Returns the tags that are currently applied to a filtered collection, or nil.

collection.url

Returns the URL of the collection.