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
| Name | Type |
|---|---|
item | CartItem |
Returns
void
Defined in
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
cartItems
• cartItems: CartItem[]
cartItems: An array of CartItem objects, representing the items in the shopping cart.
Defined in
cartLink
• 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
createCheckout
• createCheckout: () => void
Type declaration
▸ (): void
createCheckout: A function that creates a checkout session for the shopping cart.
Returns
void
Defined in
isLoading
• isLoading: boolean
isLoading: A boolean indicating whether the cart is currently being loaded or modified.
Defined in
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
| Name | Type |
|---|---|
id | number |
Returns
void
Defined in
totalCost
• totalCost: number
Total cost of everything in the cart, in USDC