# Promotions

Source: https://developers.swell.is/frontend-api/promotions

**Swell.js:**

Methods to retrieve promotions applied to the cart.

### Get promotions

Active promotions are automatically applied to carts. Retrieve the `cart` object attached to the current session to see what promotions have been applied.

The `promotions` field is a result set with a `count` and a `results` array, where each promotion includes details like `name`, `description`, `date_start`, and `date_end`.

**Get promotions**

**swell.js** `Query`

```javascript
await swell.cart.get()
```

**swell.js** `Response example`

```javascript
cart = {
  id: "63486656d9b3300012a9d6e3",
  items: [
    {
      id: "63486656d9b3300012a9d6e4",
      quantity: 1,
      price: 75,
      discount_total: 15
    }
  ],
  promotions: {
    count: 1,
    results: [
      {
        id: "63486656d9b3300012a9d6e5",
        name: "SAVE20",
        description: "Save 20% when you spend $50 or more.",
        date_start: "2022-10-01T05:00:00.000Z",
        date_end: "2022-10-31T05:00:00.000Z"
      }
    ]
  }
}
```

**GraphQL:**

Methods to retrieve promotions applied to the cart.

### Get promotions

Active promotions are automatically applied to carts. Retrieve the `cart` object attached to the current session to see what promotions have been applied.

The `promotions` field will include details like `name`, `description`, `dateStart`, and `dateEnd`.

**Get promotions**

**GraphQL** `Query`

```graphql
query {
  cart {
    items {
      id
      quantity
      price
      discountTotal
      origPrice
    }
    promotions {
      results {
        name
        description
        dateStart
        dateEnd
      }
    }
  }
}
```

**GraphQL** `Example response`

```graphql
{
  "data": {
    "cart": {
      "items": [
        {
          "id": "63486656d9b3300012a9d6e4",
          "quantity": 1,
          "price": 75,
          "discountTotal": 15,
          "origPrice": 75
        }
      ],
      "promotions": {
        "results": [
          {
            "name": "SAVE20",
            "description": "Save 20% when you spend $50 or more.",
            "dateStart": "2022-10-01T05:00:00.000Z",
            "dateEnd": "2022-10-31T05:00:00.000Z"
          }
        ]
      }
    }
  }
}
```
