DocumentationCartFunctions

Remove From Cart

amerta


amerta / Cart / removeFromCart

Function: removeFromCart()

removeFromCart(itemId, locale): Promise<{ cart: CartWithCalculations; error?: null; } | { cart?: null; error: ApiError; }>

Defined in: amerta/theme/utilities/cart.client.ts:59

Removes a product from the cart.

Parameters

| Parameter | Type | Description | | ------ | ------ | ------ | | itemId | string | The ID of the item to remove. | | locale | string | The locale string. |

Returns

Promise<{ cart: CartWithCalculations; error?: null; } | { cart?: null; error: ApiError; }>

The updated cart or an error object.

Example

const res = await removeFromCart("123", "en-US");