Skip to main content

LineItem

Overview​

LineItem is a discriminated union of possible line item types available in the High Velocity front-end app. One of these will be consistently used depending on the CartModes.

type LineItem = ProductReferenceLineItem | ProductLineItem;

ProductLineItem​

Represents a line item that contains product details. Inherits properties from BaseProductLineItem.

Attributes​

type​

type: literal = 'product'


product​

type: PurchasableProduct

The product details.

ProductReferenceLineItem​

Represents a line item that references external product details. Inherits properties from BaseProductLineItem.

Attributes​

type​

type: literal = 'ProductReference'


product​

type: ProductReference

The product details.

BaseProductLineItem​

Represents the base structure for a product line item, typically common to any vendor.

note

You are not stuck with these attributes, since you have full control of the code in High Velocity, you are free to modify, remove, or add attributes

Attributes​

id​

type: string


The unique identifier for the line item.

attributes (optional)​

type: Record<string, string>


Additional attributes selected for the product line item.

quantity​

type: number


The quantity of the product. Must be a non-negative integer.

pricing (optional)​

type: Pricing

The pricing details of the product.

sortKey (optional)​

type: string | number


A key used for sorting the line items.

subTotal (optional)​

type: Pricing

The subtotal amount for the line item.

total​

type: Pricing

The total amount for the line item.

ProductReference​

Overview​

ProductReference is a discriminated union of possible product reference types.

type ProductReference = VariantReference | HandleReference;

VariantReference​

Represents a reference to a product variant based on a unique ID, for ex. a variant SKU.

Attributes​

variantID​

type: string


The unique identifier for the product variant.

displayName (optional)​

type: string


The display name of the product variant.

handle​

type: string


The handle of the product variant.

HandleReference​

Represents a reference to a product handle. The product variant can also be identified by its selected attributes.

Attributes​

handle​

type: string


The handle of the product.

displayName (optional)​

type: string


The display name of the product.

variationAttributes (optional)​

type: Record<string, string>


The variation attributes of the product. This attribute is optional.