You are reading the documentation for v7.x and earlier, which is no longer the latest version. Switch to v8.x
deleteCart
Delete cart with a given identifier from SAP Commerce Cloud.
This method exchanges data with the removeCart endpoint exposed by the SAP OCC API Carts Controller.
When vsf-sap-token cookie is present in the request, this method will delete the current user cart. In case there is no cookie, it will delete an anonymous user cart. For logged-in users, make sure to pass cart code as the cartId param. In case of anonymous users, pass cart guid instead.
Signature
export declare function deleteCart(
context: SapccIntegrationContext,
props: DeleteCartProps
): Promise<void>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
context | Required | SapccIntegrationContext | |
props | Required | DeleteCartProps | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
Returns
This method does not return anything.
Referenced Types
Examples
Deleting a cart.
import { sdk } from '~/sdk';
await sdk.commerce.deleteCart({ cartId: '00035084' });