Class ShopperProducts<ConfigParameters>

Shopper Products

Display product details across your storefront.

Simple example:

  import { ShopperProducts } from "commerce-sdk-isomorphic";

const clientConfig = {
parameters: {
clientId: "XXXXXX",
organizationId: "XXXX",
shortCode: "XXX",
siteId: "XX"
}
};
const shopperProductsClient = new ShopperProducts(clientConfig);
API Version: 0.0.24
Last Updated:

Type Parameters

Hierarchy

  • ShopperProducts

Constructors

Methods

  • When you use the URL template, the server returns multiple categories (a result object of category documents). You can use this template as a convenient way of obtaining multiple categories in a single request, instead of issuing separate requests for each category. You can specify up to 50 multiple IDs. You must enclose the list of IDs in parentheses. If a category identifier contains parenthesis or the separator sign, you must URL encode the character. The server only returns online categories.

    If you would like to get a raw Response object use the other getCategories function.

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId" | "siteId" | "locale" | "ids" | "levels"]: (Omit<{
                  ids: string;
                  levels?: number;
                  locale?: string;
                  organizationId: string;
                  siteId: string;
              }, keyof ConfigParameters> & Partial<{
                  ids: string;
                  levels?: number;
                  locale?: string;
                  organizationId: string;
                  siteId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<CategoryResult>

    A promise of type CategoryResult.

  • When you use the URL template, the server returns multiple categories (a result object of category documents). You can use this template as a convenient way of obtaining multiple categories in a single request, instead of issuing separate requests for each category. You can specify up to 50 multiple IDs. You must enclose the list of IDs in parentheses. If a category identifier contains parenthesis or the separator sign, you must URL encode the character. The server only returns online categories.

    Type Parameters

    • T extends boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId" | "siteId" | "locale" | "ids" | "levels"]: (Omit<{
                  ids: string;
                  levels?: number;
                  locale?: string;
                  organizationId: string;
                  siteId: string;
              }, keyof ConfigParameters> & Partial<{
                  ids: string;
                  levels?: number;
                  locale?: string;
                  organizationId: string;
                  siteId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : CategoryResult>

    A promise of type Response if rawResponse is true, a promise of type CategoryResult otherwise.

  • When you use the URL template below, the server returns a category identified by its ID; by default, the server also returns the first level of subcategories, but you can specify another level by setting the levels parameter. The server only returns online categories.

    If you would like to get a raw Response object use the other getCategory function.

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId" | "siteId" | "locale" | "id" | "levels"]: (Omit<{
                  id: string;
                  levels?: number;
                  locale?: string;
                  organizationId: string;
                  siteId: string;
              }, keyof ConfigParameters> & Partial<{
                  id: string;
                  levels?: number;
                  locale?: string;
                  organizationId: string;
                  siteId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<Category>

    A promise of type Category.

  • When you use the URL template below, the server returns a category identified by its ID; by default, the server also returns the first level of subcategories, but you can specify another level by setting the levels parameter. The server only returns online categories.

    Type Parameters

    • T extends boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId" | "siteId" | "locale" | "id" | "levels"]: (Omit<{
                  id: string;
                  levels?: number;
                  locale?: string;
                  organizationId: string;
                  siteId: string;
              }, keyof ConfigParameters> & Partial<{
                  id: string;
                  levels?: number;
                  locale?: string;
                  organizationId: string;
                  siteId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : Category>

    A promise of type Response if rawResponse is true, a promise of type Category otherwise.

  • Allows access to product details for a single product ID. Only products that are online and assigned to a site catalog are returned. Along with product details, the availability, images, price, bundled_products, set_products, recommedations, product options, variations, and promotions for the products will be included, as appropriate.

    If you would like to get a raw Response object use the other getProduct function.

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId" | "siteId" | "locale" | "currency" | "inventoryIds" | "expand" | "allImages" | "perPricebook" | "id"]: (Omit<{
                  allImages?: boolean;
                  currency?: string;
                  expand?: string;
                  id: string;
                  inventoryIds?: string;
                  locale?: string;
                  organizationId: string;
                  perPricebook?: boolean;
                  siteId: string;
              }, keyof ConfigParameters> & Partial<{
                  allImages?: boolean;
                  currency?: string;
                  expand?: string;
                  id: string;
                  inventoryIds?: string;
                  locale?: string;
                  organizationId: string;
                  perPricebook?: boolean;
                  siteId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<Product$0>

    A promise of type Product.

  • Allows access to product details for a single product ID. Only products that are online and assigned to a site catalog are returned. Along with product details, the availability, images, price, bundled_products, set_products, recommedations, product options, variations, and promotions for the products will be included, as appropriate.

    Type Parameters

    • T extends boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId" | "siteId" | "locale" | "currency" | "inventoryIds" | "expand" | "allImages" | "perPricebook" | "id"]: (Omit<{
                  allImages?: boolean;
                  currency?: string;
                  expand?: string;
                  id: string;
                  inventoryIds?: string;
                  locale?: string;
                  organizationId: string;
                  perPricebook?: boolean;
                  siteId: string;
              }, keyof ConfigParameters> & Partial<{
                  allImages?: boolean;
                  currency?: string;
                  expand?: string;
                  id: string;
                  inventoryIds?: string;
                  locale?: string;
                  organizationId: string;
                  perPricebook?: boolean;
                  siteId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : Product$0>

    A promise of type Response if rawResponse is true, a promise of type Product otherwise.

  • Allows access to multiple products by a single request. Only products that are online and assigned to a site catalog are returned. The maximum number of productIDs that can be requested are 24. Along with product details, the availability, product options, images, price, promotions, and variations for the valid products will be included, as appropriate.

    If you would like to get a raw Response object use the other getProducts function.

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId" | "siteId" | "locale" | "currency" | "ids" | "inventoryIds" | "expand" | "allImages" | "perPricebook"]: (Omit<{
                  allImages?: boolean;
                  currency?: string;
                  expand?: string;
                  ids: string;
                  inventoryIds?: string;
                  locale?: string;
                  organizationId: string;
                  perPricebook?: boolean;
                  siteId: string;
              }, keyof ConfigParameters> & Partial<{
                  allImages?: boolean;
                  currency?: string;
                  expand?: string;
                  ids: string;
                  inventoryIds?: string;
                  locale?: string;
                  organizationId: string;
                  perPricebook?: boolean;
                  siteId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<ProductResult>

    A promise of type ProductResult.

  • Allows access to multiple products by a single request. Only products that are online and assigned to a site catalog are returned. The maximum number of productIDs that can be requested are 24. Along with product details, the availability, product options, images, price, promotions, and variations for the valid products will be included, as appropriate.

    Type Parameters

    • T extends boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId" | "siteId" | "locale" | "currency" | "ids" | "inventoryIds" | "expand" | "allImages" | "perPricebook"]: (Omit<{
                  allImages?: boolean;
                  currency?: string;
                  expand?: string;
                  ids: string;
                  inventoryIds?: string;
                  locale?: string;
                  organizationId: string;
                  perPricebook?: boolean;
                  siteId: string;
              }, keyof ConfigParameters> & Partial<{
                  allImages?: boolean;
                  currency?: string;
                  expand?: string;
                  ids: string;
                  inventoryIds?: string;
                  locale?: string;
                  organizationId: string;
                  perPricebook?: boolean;
                  siteId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : ProductResult>

    A promise of type Response if rawResponse is true, a promise of type ProductResult otherwise.

Properties

clientConfig: ClientConfig<ConfigParameters> & {
    baseUri: string;
}
defaultBaseUri: "https://{shortCode}.api.commercecloud.salesforce.com/product/shopper-products/{version}" = "https://{shortCode}.api.commercecloud.salesforce.com/product/shopper-products/{version}"