SessionCartContextState
Properties
The region of the cart.
The items in the cart.
totalItems
numberRequiredThe total items in the cart.
total
numberRequiredThe total amount of the cart.
A state function used to set the region.
This function adds an item to the session cart.
removeItem
(id: string) => voidRequiredThis function removes an item from the session cart.
This function updates an item in the session cart.
A state function used to set the items in the cart.
updateItemQuantity
(id: string, quantity: number) => voidRequiredThis function updates an item's quantity in the cart.
incrementItemQuantity
(id: string) => voidRequiredThis function increments the item's quantity in the cart.
decrementItemQuantity
(id: string) => voidRequiredThis function decrements the item's quantity in the cart.
This function retrieves an item's details by its ID.
clearItems
() => voidRequiredRemoves all items in the cart.
Was this section helpful?