Skip to main content

Interface: CartContextProps

The shape of the context object that provides a set of functions and properties for managing the shopping cart.

Properties​

addToCart​

• addToCart: (item: CartItem) => void

Type declaration​

▸ (item): void

addToCart: A function that accepts a CartItem object as a parameter and adds the item to the shopping cart.

Parameters​
NameType
itemCartItem
Returns​

void

Defined in​

hooks/useCart.tsx:23


cartId​

• cartId: undefined | string

cartId: A string representing the unique identifier of the cart, or undefined if the cart has not been created yet.

Defined in​

hooks/useCart.tsx:47


cartItems​

• cartItems: CartItem[]

cartItems: An array of CartItem objects, representing the items in the shopping cart.

Defined in​

hooks/useCart.tsx:17


• cartLink: undefined | string

cartLink: A string representing the URL for the cart's checkout page, or undefined if the cart has not been created yet.

Defined in​

hooks/useCart.tsx:53


createCheckout​

• createCheckout: () => void

Type declaration​

▸ (): void

createCheckout: A function that creates a checkout session for the shopping cart.

Returns​

void

Defined in​

hooks/useCart.tsx:35


isLoading​

• isLoading: boolean

isLoading: A boolean indicating whether the cart is currently being loaded or modified.

Defined in​

hooks/useCart.tsx:41


removeFromCart​

• removeFromCart: (id: number) => void

Type declaration​

▸ (id): void

removeFromCart: A function that accepts an item's ID as a parameter and removes the corresponding item from the shopping cart.

Parameters​
NameType
idnumber
Returns​

void

Defined in​

hooks/useCart.tsx:29


totalCost​

• totalCost: number

Total cost of everything in the cart, in USDC

Defined in​

hooks/useCart.tsx:58