Skip to main content

Cart

Overview

The Cart type represents a shopping cart in the High Velocity front-end app. It is a generic type that extends LineItemContainer and BaseCart, and can be customized based on the CartModes.

Attributes

lineItemType

type: 'expanded' | 'reference'


Defines the type of line items in the cart. Can be either 'expanded' or 'reference'.

lineItemPricing

type: 'internal' | 'external'


Defines the pricing model for the line items in the cart. Can be either 'internal' or 'external'.

LineItemContainer

Defines lineItems attribute type for a line item container (such as a Cart or an Order)

Attributes

lineItems

type: LineItem[]

A line item container will have different types for the lineItems attribute depending on the lineItemType for the CartModes

lineItemType === 'product': ProductLineItem[]

lineItemType === 'reference': ProductReferenceLineItem[]

CartModes

Cart integrations may behave differently depending on how you want to combine your data models. CartModes defines the modes available.

lineItemPricing = 'external' | 'internal'

external

The cart integration expects pricing to be provided externally. In this mode, the cart does not know how to price line items by itself. Typical if the cart is provided by a simple persistance layer instead of a commerce vendor.

internal

The cart integration can price line items on its own. Typical if the cart is provided by a commerce vendor.

lineItemType = 'expanded' | 'reference'

expanded

Line items have full product models attached.

reference

Line items returned will have references to products which will need to be dereferenced to get a full product model.