Skip to content
On this page

clearCart

Definition

When no sw-context-token given then this method return an empty cart with the new sw-context-token.

When sw-context-token given then this method simply returns the current state of the cart.

As the purpose of this method is not clear we recommend to use getCart method because its behaviour seems to be the same.

Signature

ts
export async function clearCart(
  contextInstance: ShopwareApiInstance = defaultInstance,
): Promise<ContextTokenResponse> 

Parameters

NameTypeDescription
contextInstance
ShopwareApiInstance
instance of the api client (by default it's an Axios instance)

Return type

ts
Promise<ContextTokenResponse>

Usage example

WARNING

Example is generated automatically. Sometimes it's required to be adjusted to your needs.

Open in StackBlitz

clearCart has loaded