removeCouponFromCart mutation

The removeCouponFromCart mutation removes a previously-applied coupon from the cart.

Syntax

mutation: {removeCouponFromCart(input: RemoveCouponFromCartInput) {RemoveCouponFromCartOutput}}

Example usage

The following example removes a coupon from the cart.

Request

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
mutation {
  removeCouponFromCart(
    input: 
      { cart_id: "IeTUiU0oCXjm0uRqGCOuhQ2AuQatogjG" }
    ) {
    cart {
      items {
        product {
          name
        }
        quantity
      }
      applied_coupon {
        code
      }
      prices {
        grand_total{
          value
          currency
        }
      }
    }
  }
}

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
  "data": {
    "removeCouponFromCart": {
      "cart": {
        "items": [
          {
            "product": {
              "name": "Strive Shoulder Pack"
            },
            "quantity": 1
          },
          {
            "product": {
              "name": "Affirm Water Bottle "
            },
            "quantity": 1
          }
        ],
        "applied_coupon": null,
        "prices": {
          "grand_total": {
            "value": 39,
            "currency": "USD"
          }
        }
      }
    }
  }
}

Input attributes

The removeCouponFromCart mutation requires the cart_id attribute.

removeCouponFromCart object

The removeCouponFromCart object must contain the following attributes:

Attribute Data Type Description
cart_id String! The unique ID that identifies the customer’s cart

Output attributes

The removeCouponFromCart object contains the Cart object.

Attribute Data Type Description
cart Cart! Describes the contents of the specified shopping cart

Cart object

Attribute Data Type Description
applied_coupon AppliedCoupon The AppliedCoupon object contains the code text attribute, which specifies the coupon code
available_payment_methods AvailablePaymentMethod Available payment methods
billing_address BillingCartAddress Contains the billing address specified in the customer’s cart
email String The customer’s email address
items CartItemInterface Contains the items in the customer’s cart
prices CartPrices Contains subtotals and totals
selected_payment_method SelectedPaymentMethod Selected payment method
shipping_addresses ShippingCartAddress Contains one or more shipping addresses

Cart query output provides more information about the Cart object.