CartItem type
Reference for the CartItem type, which represents the possible item types within a cart in Checkout extensions.
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:
_10type CartItem = CartAvailableItem | CartUnavailableItem;
Here are the respective types for CartAvailableItem and CartUnavailableItem:
_10type CartAvailableItem = BaseCartItem & {_10 status: 'available';_10 price: number;_10};_10_10type CartUnavailableItem = BaseCartItem & {_10 status: 'unavailable';_10 price?: number;_10};
BaseCartItem
Both CartAvailableItem and CartUnavailableItem extend BaseCartItem, which has the following structure:
_10type 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:
_10type Offering = {_10 type: string;_10 name: string;_10 id: string;_10};