The Commerce Provider is responsible for displaying product prices (including currency formatting) and handling the Add to Cart functionality. To customise this behaviour, you must implement the following interface.

interface ICommerceProvider {
    addToCart?(items: CartItem[]): Awaitable<void>;
    addToCartIntend?(items: ReferenceData[]): Awaitable<void>;
    allowAddToCart?(): Awaitable<boolean>;
    allowAddToCartBundle?(): Awaitable<boolean>;
    getCurrencyForId(id: ReferenceData): Awaitable<undefined | string>;
    getPriceForId(id: ReferenceData): Awaitable<undefined | number>;
    getStrikePriceForId(id: ReferenceData): Awaitable<undefined | number>;
}

Methods

  • If this is implemented the function is called if the customer would like to purchase the items identified in the items parameter.

    No size selection happened yet.

    This callback could show a screen for the user to select garment sizes, etc.

    Parameters

    • items: ReferenceData[]

      Array of IDs of the garments the customer would like to purchase

    Returns Awaitable<void>

  • Returns true if it is allowed to run add to cart operation for a set of garmetns. If it is not set it will default to true!

    Returns Awaitable<boolean>

    true if it is allowed to run add to cart operations in the MDRC