@avvyr/storefront-sdk - v0.19.0
    Preparing search index...

    Class ProductsResource

    Index
    • Get multiple products by SKU list.

      Batch is a LIST endpoint, so it returns no attributes unless you name them — see ProductListOptions.attributes. It has no variants at all: there is no grouping here, so variants does not apply.

      Parameters

      • skus: string[]
      • options: Pick<ProductListOptions, "attributes"> = {}

      Returns Promise<{ products: StorefrontProduct[]; success: boolean }>

    • Get multiple products by product id.

      Bundle components, cart lines and checkout rows reference products by id rather than SKU, so they need this rather than getBatch. The endpoint is the same; passing ids selects the id lookup server-side.

      Parameters

      • ids: string[]
      • options: Pick<ProductListOptions, "attributes"> = {}

      Returns Promise<StorefrontProduct[]>

    • Get a single product by URL handle/slug

      Parameters

      • handle: string

      Returns Promise<StorefrontProduct>

    • The products behind one listing address (listingHandle, e.g. "st-hermine/svart"), cheapest first. A parent-child family split per colour has one address per colour; pick ?sku= when given, otherwise the first in stock. Every card and product carries its listingHandle.

      Parameters

      • listingHandle: string

      Returns Promise<StorefrontProduct[]>

    • Get products by product relation rule

      Parameters

      • ruleId: string
      • params: RuleProductParams = {}

      Returns Promise<RelatedProductGroup>

    • Get a single product by SKU

      Parameters

      • sku: string

      Returns Promise<StorefrontProduct>

    • An option catalog as the product page shows it (GET /:marketId/option-catalogs/:catalogRef): groups in catalog order and every active item with label, group, swatches and attributes in the market's language (or locale). No prices, the same for every visitor: public and ETag-cached, version = the slim profile's catalogVersion. 404 OPTION_CATALOG_NOT_FOUND.

      Parameters

      • catalogRef: string
      • params: { locale?: string } = {}

      Returns Promise<OptionCatalogView>

    • The product's option profile: positions, the options allowed at each and every charge with its price ladder. Works on the parent or any variant. 404 OPTION_PROFILE_NOT_FOUND without one.

      slim: true (?slim=1): a matrix position's options carry only code, label and group, plus catalogVersion; the swatches and attributes come from getOptionCatalog (public, cached) and options.mergeCatalogs puts them together. Without a customer group the class prices come from the product index. locale defaults to the market's language.

      Parameters

      • sku: string
      • params: { locale?: string; slim?: boolean } = {}

      Returns Promise<OptionProfileView>

    • Get related products for a SKU (cross-sell, upsell, etc.).

      Results are product cards, so both opt-ins apply: name the attribute codes your card renders and ask for variants only if it shows a swatch row. Neither is returned by default.

      Parameters

      • sku: string
      • options: RelatedProductOptions = {}

      Returns Promise<RelatedProductGroup[]>

    • Get products by variant group ID

      Parameters

      • variantGroupId: string

      Returns Promise<StorefrontProduct[]>

    • Typeahead search suggestions. Empty query returns popular searches/products.

      Parameters

      Returns Promise<SuggestResponse>