Menu
Guides
API Reference

Guides

CartItem type

Reference for the CartItem type, which represents the possible item types within a cart in Checkout extensions.

1 min read

This feature is only available for stores using B2B Buyer Portal, which is currently available to selected accounts.

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


_10
type CartItem = CartAvailableItem | CartUnavailableItem;

Here are the respective types for CartAvailableItem and CartUnavailableItem:


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

BaseCartItem

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


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

The originalIndex property represents the unique position of the item in the cart and is used for operations like removing items via the removeItem function available in the useCart and useCartPunchout hooks.

Offering

The Offering type is defined as:


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