Skip to main content

assignProductsToBrand

Requires permission products:brand:update.

Assign existing products to a brand. Products already on another brand are moved; ones already on this brand are skipped. Needs the brands update permission.

Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.

Example:

mutation AssignProductsToBrand($brandId: ID!, $productIds: [ID!]!) {
assignProductsToBrand(brandId: $brandId, productIds: $productIds) {
changedCount
reassignedCount
skippedCount
brand {
id
code
name
createdAt
deletedAt
deletedBy
}
}
}

Variables:

{
"brandId": "id",
"productIds": [
"id"
]
}

Response:

{
"data": {
"assignProductsToBrand": {
"changedCount": 0,
"reassignedCount": 0,
"skippedCount": 0,
"brand": {
"id": "id",
"code": "string",
"name": "string",
"createdAt": "2025-01-15T00:00:00Z",
"deletedAt": "2025-01-15T00:00:00Z",
"deletedBy": "string"
}
}
}
}
assignProductsToBrand(
brandId: ID!
productIds: [ID!]!
): BrandProductAssignmentResult!

Arguments​

assignProductsToBrand.brandId ● ID! non-null scalar​

The ID of the brand.

assignProductsToBrand.productIds ● [ID!]! non-null scalar​

The IDs of the products.

Type​

BrandProductAssignmentResult object​

The result of assigning existing products to a brand, or removing them.