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

# clearCart() function

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