> ## Documentation Index
> Fetch the complete documentation index at: https://developer.jtl-software.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SaveShopCustomerGroups

> Replaces the complete set of customer groups assigned to a shop. The request describes the desired state: listed customer groups are assigned, all others are unassigned. The list must not be empty, and exactly one customer group must be marked as default. If a removed customer group still has customers, name a replacement group in "Replacements"; missing replacements for all affected groups are reported together in one 409 error. Returns the resulting assignments. Concurrency: last write wins; concurrent calls for the same shop overwrite each other without a conflict error.



**mutation** `SaveShopCustomerGroups(request: SaveShopCustomerGroupsCommandRequestInput!): SaveShopCustomerGroupsCommandResponse!`

## Arguments

**`request`**: `SaveShopCustomerGroupsCommandRequestInput!` (required)

## Returns

`SaveShopCustomerGroupsCommandResponse!`

**`customerGroups`**: `[ShopCustomerGroupListItem!]!`

The persisted customer group assignments, in the order submitted.

---

**`resyncFailed`**: `Boolean!`

Whether the outbound customer resync push to the shop failed after the customer group assignments were already persisted. The assignments are unaffected either way; this only reports the live push outcome, it is not retried automatically.

---

**`resyncError`**: `String!`

Generic, client-facing description of why ResyncFailed is true. Empty when ResyncFailed is false.

## Examples

```graphql Mutation
mutation SaveShopCustomerGroups($request: SaveShopCustomerGroupsCommandRequestInput!) {
  SaveShopCustomerGroups(request: $request) {
    customerGroups {
      customerGroupId
      isAssigned
      isDefault
    }
    resyncFailed
    resyncError
  }
}
```

```json Variables
{
  "request": {
    "salesChannelId": "string",
    "customerGroups": [
      {
        "customerGroupId": "id",
        "isDefault": true
      }
    ]
  }
}
```

```json Response
{
  "data": {
    "SaveShopCustomerGroups": {
      "customerGroups": [
        {
          "customerGroupId": "id",
          "isAssigned": true,
          "isDefault": true
        }
      ],
      "resyncFailed": true,
      "resyncError": "string"
    }
  }
}
```
