Skip to content

CartItem

The CartItem type represents the possible item types within a cart. In summary, its signature and the types used follow this contract:

type CartItem = CartAvailableItem | CartUnavailableItem;

Here are the respective types for CartAvailableItem and CartUnavailableItem:

type CartAvailableItem = BaseCartItem & {
status: 'available';
price: number;
};
type CartUnavailableItem = BaseCartItem & {
status: 'unavailable';
price?: number;
};

BaseCartItem

Both CartAvailableItem and CartUnavailableItem extend BaseCartItem, which has the following structure:

type BaseCartItem = {
id: string;
quantity: number;
imageUrl: string;
productUrl: string;
offerings: Array<Offering>;
};

Offering

The Offering type is defined as:

type Offering = {
type: string;
name: string;
id: string;
};