Magento Commerce only

removeGiftCardFromCart mutation

The removeGiftCardFromCart mutation removes a previously-applied gift card from the cart.

Syntax

mutation: removeGiftCardFromCart(input: RemoveGiftCardFromCartInput): RemoveGiftCardFromCartOutput

Example usage

The following example removes a gift card from the cart.

Request:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
mutation {
  removeGiftCardFromCart(
    input: {
      cart_id: "lOeLKsVkZ1PEvA8A7EaCvmEAk4JRBR7A"
      gift_card_code: "049XDMZ6L81X"
    }
  ) {
    cart {
      applied_gift_cards {
        code
      }
    }
  }
}

Response:

1
2
3
4
5
6
7
8
9
{
  "data": {
    "removeGiftCardFromCart": {
      "cart": {
        "applied_gift_cards": []
      }
    }
  }
}

Input attributes

The removeGiftCardFromCartInput object must contain the following attributes:

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

Output attributes

The removeGiftCardFromCartOutput 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 Deprecated. Use applied_coupons instead
applied_coupons [AppliedCoupon] An array of AppliedCoupon objects. Each object contains the code text attribute, which specifies the coupon code
applied_gift_cards [AppliedGiftCard] An array of AppliedGiftCard objects. An AppliedGiftCard object contains the code text attribute, which specifies the gift card code. applied_gift_cards is a Commerce-only attribute, defined in the GiftCardAccountGraphQl module
applied_store_credit AppliedStoreCredit Contains store credit information applied to the cart. applied_store_credit is a Commerce-only attribute, defined in the CustomerBalanceGraphQl module
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
id ID! The ID of the cart
is_virtual Boolean Indicates whether the cart contains only virtual products
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
total_quantity Float! Total Quantity of products in the cart

Cart query output provides more information about the Cart object.