data-src=../../../../../includes/commerce-only.md

clearCustomerCart mutation

The clearCustomerCart mutation clears the customer's cart. B2B requisition lists must be enabled to execute this mutation.

data-variant=info
data-slots=text
Use the storeConfig query with the is_requisition_list_active attribute to determine whether requisition lists are enabled.

This mutation requires a valid customer authentication token.

Syntax

mutation {
  clearCustomerCart(
    cartUid: String!
  ) {
    ClearCustomerCartOutput
  }
}

Reference

The clearCustomerCart reference provides detailed information about the types and fields defined in this mutation.

Example usage

The following example clears the customer's cart.

Request:

mutation {
  clearCustomerCart(
      cartUid: "8k0Q4MpH2IGahWrTRtqM61YV2MtLPApz"
    ) {
        status
    }
}

Response:

{
  "data": {
    "clearCustomerCart": {
        "status": "true"
    }
  }
}
data-slots=text
data-backgroundcolor=gray
Thanks to EY for contributing this topic!