pify/storefront/collection

Storefront collections: one by handle, a page of them, and a page of the products in one.

Types

pub type Collection {
  Collection(
    id: String,
    handle: String,
    title: String,
    description: String,
    description_html: String,
    updated_at: String,
    image: option.Option(storefront.Image),
    seo: storefront.Seo,
  )
}

Constructors

pub type CollectionPage {
  CollectionPage(
    first: Int,
    after: option.Option(String),
    sort: CollectionSort,
    reverse: Bool,
  )
}

Constructors

The sort keys of the products in a collection, which differ from the sort keys of the catalog.

pub type CollectionSort {
  CollectionSortCollectionDefault
  CollectionSortManual
  CollectionSortTitle
  CollectionSortPrice
  CollectionSortBestSelling
  CollectionSortCreated
  CollectionSortId
  CollectionSortRelevance
}

Constructors

  • CollectionSortCollectionDefault
  • CollectionSortManual
  • CollectionSortTitle
  • CollectionSortPrice
  • CollectionSortBestSelling
  • CollectionSortCreated
  • CollectionSortId
  • CollectionSortRelevance

Values

pub fn by_handle(
  client: storefront.StorefrontClient,
  handle: String,
) -> effect.Effect(
  Result(option.Option(Collection), error.ShopifyError),
  key,
)
pub const by_handle_query: String
pub fn collection_sort_to_string(sort: CollectionSort) -> String
pub const fields: String
pub fn first_page(first: Int) -> CollectionPage

The first page of a collection in the order the shop set.

pub const list_query: String
pub fn products(
  client: storefront.StorefrontClient,
  handle: String,
  page: CollectionPage,
  metafields: List(storefront.MetafieldIdentifier),
) -> effect.Effect(
  Result(
    option.Option(graphql.Connection(product.Product)),
    error.ShopifyError,
  ),
  key,
)

Ok(None) when no collection has the handle.

pub const products_query: String
pub fn products_variables(
  handle: String,
  page: CollectionPage,
  metafields: List(storefront.MetafieldIdentifier),
) -> json.Json
✨ Search Document