CartRecommendationsList

Methods

refresh

Gets new recommendations based on the current SKUs.

setSkus

Sets the SKUs in the cart.

Parameters

  • skus: string[]

    The SKUs of products in the cart.

subscribe

Adds a callback that will be called on state change.

Parameters

  • listener: () ⇒ void

    A callback to be invoked on state change.

Returns Unsubscribe: An unsubscribe function to remove the listener.

Attributes

state

The state of the CartRecommendationsList controller.

Properties

  • error: ErrorPayload | null

    The error returned by the Coveo platform while executing the cart recommendation request, if any. null otherwise.

  • isLoading: boolean

    Whether the cart recommendation request is currently being executed against the Coveo platform.

  • maxNumberOfRecommendations: number

    The maximum number of recommendations.

  • recommendations: ProductRecommendation[]

    The products recommended by the Coveo platform.

  • skus: string[]

    The SKUs of products in the cart.

Initialize

buildCartRecommendationsList

Creates a CartRecommendationsList controller instance.

Parameters

  • engine: Engine<ProductRecommendationsSection & ConfigurationSection>

    The headless engine.

  • props: CartRecommendationsListProps

    The configurable CartRecommendationsList properties.

Returns CartRecommendationsList

CartRecommendationsListProps

The configurable CartRecommendationsList properties.

Properties

CartRecommendationsListOptions

Properties

  • maxNumberOfRecommendations?: number

    The maximum number of recommendations, from 1 to 50.

  • skus?: string[]

    The SKUs of products in the cart.

ProductRecommendation

Properties

  • brand?: string

    Product brand.

    From the ec_brand field.

  • category?: string

    Category of the product (e.g., "Electronics", "Electronics|Televisions", or "Electronics|Televisions|4K Televisions")

    From the ec_category field.

  • imageUrls?: string[]

    Additional product images in URL format.

    From the ec_images field.

  • inStock?: boolean

    Availability of the product (i.e., whether the product is in stock).

    From the ec_in_stock field.

  • link: string

    A direct link to the product in URL format.

  • name: string

    Name of the product.

    From the ec_name field.

  • price?: number

    Base price of the product or variant.

    From the ec_price field.

  • promoPrice?: number

    Promotional price of product or variant.

    From the ec_promo_price field.

  • rating?: number

    A rating based system from 0-10.

    From the ec_rating field.

  • shortDescription?: string

    Short description of the product.

    From the ec_shortdesc field.

  • sku: string

    The SKU of the product.

  • thumbnailUrl?: string

    Product image in URL format.

    From the ec_thumbnail field.

Unsubscribe

Call signatures

  • (): void

Recommended Articles