[Video](https://www.youtube.com/watch?v=2gTCghy-dU4)

## Use a grouping ID


By default, adding multiple passes to a single
**Add to Google Wallet** link will not group those passes in the
user's Google Wallet app. However, passes can be grouped together by making
sure they all have the same grouping ID. Grouped passes will appear together
in the Google Wallet app. When a group of passes is selected, each pass will
be shown on a carousel.

Passes can be grouped together:

- During initial provisioning
- By using the [`update`](https://developers.google.com/wallet/tickets/events/rest/v1/eventticketobject/update) or [`patch`](https://developers.google.com/wallet/tickets/events/rest/v1/eventticketobject/patch) methods


To add a pass to a group, the `groupingInfo.groupingId` property of
the pass object must be set. All pass objects with the same
`groupingId` value will be automatically grouped together, even if
they were added separately.


The following example shows a loyalty card and offer being grouped together to
entice the user to make use of both in their next purchase.

```
loyaltyObject = {
  "classId": "ISSUER_ID.GIFT_CARD_CLASS_SUFFIX",
  "id": "ISSUER_ID.GIFT_CARD_OBJECT_SUFFIX",
  "state": "ACTIVE",
  "groupingInfo": {
    # Note the same groupingId value
    "groupingId": "combinedGiftCardAndOfferId",
    "sortIndex": 1
  },
  "barcode": {
    "type": "QR_CODE",
    "value": "QR code"
  },
  "accountId": "Account id",
  "accountName": "Account name",
  "loyaltyPoints": {
  "label": "Points",
    "balance": {
      "int": 800
    }
  }
}

offerObject = {
  "classId": "ISSUER_ID.OFFER_CLASS_SUFFIX",
  "id": "ISSUER_ID.OFFER_OBJECT_SUFFIX",
  "state": "ACTIVE",
  "groupingInfo": {
    # Note the same groupingId value
    "groupingId": "combinedGiftCardAndOfferId",
    "sortIndex": 2
  },
  "barcode": {
      "type": "QR_CODE",
      "value": "QR code",
  },
}
```

## Event ticket automatic grouping

> [!NOTE]
> **Note:** The `groupingInfo` property of a pass will always take precedence over the automatic grouping logic used by Event tickets.

Sometimes event tickets are used in a group rather than individually. A common
scenario for this is grouping of tickets for multiple family members.

Event tickets have additional logic that enables automatic grouping based on
the following properties:

- `EventClass.eventId`
- `EventClass.eventName`
- `EventClass.dateTime.start`
- The Issuer ID portion of `EventObject.id`

> [!NOTE]
> **Note:** If `EventClass.eventId` is set, it takes precedence in order to determine what objects are considered to be in a group.

### Grouping with `EventClass.eventId`

Event ticket objects are automatically grouped when they have the same values
for the following properties:

- `EventClass.eventId`
- The Issuer ID portion of `EventObject.id`

When event ticket objects meet this criteria, they will be grouped even when
`EventClass.eventName` and `EventClass.dateTime.start` are different.

### Grouping without `EventClass.eventId`

If `EventClass.eventId` isn't set, they will be automatically grouped if the
following properties are the same.

- `EventClass.eventName`
- `EventClass.dateTime.start`
- The Issuer ID portion of `EventObject.id`

> [!NOTE]
> **Note:** `EventClass.dateTime.start` is an optional property. If it isn't set, then only `EventClass.eventName` and the Issuer ID portion of `EventObject.id` are used to determine grouping.