# Gift cards

Source: https://developers.swell.is/frontend-api/gift-cards

**Swell.js:**

Methods to apply and remove gift cards from the cart.

### Apply a gift card

Use to apply a gift card code to the cart. A cart can have multiple gift card codes applied at once. Codes are not case-sensitive.

Returns the updated cart object if the gift card code is valid. Otherwise, it returns a validation error.

**Apply a gift card**

**swell.js**

```javascript
await swell.cart.applyGiftcard('BUYS SFX4 BMZH YY7N')
```

### Remove a gift card

Use to remove a gift card from the cart; pass the `id` of the corresponding entry in `cart.giftcards`.

**Remove a gift card**

**swell.js**

```javascript
await swell.cart.removeGiftcard('5c15505200c7d14d851e51af')
```

**GraphQL:**

Methods to apply and remove gift cards from the cart.

### Apply a gift card

Use to apply a gift card to an account order. Returns the updated cart object if the gift card code is valid. Otherwise, it returns a validation error.

The parameters for this query are `code` (required), `_locale`, and `_currency`.

**Apply a gift card**

**GraphQL**

```graphql
mutation {
  applyGiftcard(code: "LPESSJKX6MKB6UMJ") {
    accountId
    grandTotal
    giftcards {
      id
      code
      amount
    }
  }
}
```

### Remove a gift card

Use to remove a gift card from an account order. Returns the updated cart object.

The parameters for this mutation are `giftcardId` (required), `_locale`, and `_currency`.

**Remove a gift card**

**GraphQL**

```graphql
mutation {
  removeGiftcard(giftcardId: "61d4bbbad38cb5013273b062") {
    accountId
    grandTotal
    giftcards {
      id
      code
      amount
    }
  }
}
```
