Home > @shopware-pwa/shopware-6-client > clearCart

# clearCart() function

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

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:

export declare function clearCart(contextInstance?: ShopwareApiInstance): Promise<ContextTokenResponse>;

# Parameters

Parameter Type Description
contextInstance ShopwareApiInstance

Returns:

Promise<ContextTokenResponse>

# Exceptions

ClientApiError