Edit in GitHubLog an issue

setCartAsInactive mutation

The setCartAsInactive mutation sets a specific cartId as inactive. Use this mutation when a payment error occurs, or when a shopper cancels a payment flow, after the addProductsToNewCart mutation returns a cartId. This mutation helps prevent a customer having multiple active carts created with the addProductsToNewCart mutation.

See the addProductsToNewCart mutation use case for more information about a common workflow for the setCartAsInactive mutation.

Syntax

Copied to your clipboard
mutation {
setCartAsInactive(
cartId: String!
): SetCartAsInactiveOutput
}

Example usage

The following examples show responses to the setCartAsInactive mutation.

Request:

Copied to your clipboard
mutation {
setCartAsInactive(
cartId: "gVFVNBSJPt7L6uCQis4Q1ryj6DQtcwM2"
) {
success
error
}
}

Set cart as inactive (success)

The following response example shows what the mutation returns when setCartAsInactive is successful, and no error.

Response:

Copied to your clipboard
{
"data": {
"setCartAsInactive": {
"success": true,
"error": null
}
}
}

Set cart as inactive (failure)

The following example response indicates the mutation failed due to a non-existent cartId.

Response:

Copied to your clipboard
{
"data": {
"setCartAsInactive": {
"success": false,
"error": "Error when setting the cart gVFVNBSJPt7L6uCQis4Q1ryj6QtcwM2 as inactive - No such entity with cartId = null "
}
}
}
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2025 Adobe. All rights reserved.