assignCategoriesToScheme
Requires permission products:discount:update.
Replaces the categories a discount scheme applies to with the list given. The existing assignments are removed first, and the scheme and every category must belong to the organization. Needs the discounts 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:
- GraphQL
- cURL
mutation AssignCategoriesToScheme($data: AssignCategoriesDto!, $schemeId: String!) {
assignCategoriesToScheme(data: $data, schemeId: $schemeId)
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation AssignCategoriesToScheme($data: AssignCategoriesDto!, $schemeId: String!) {\n assignCategoriesToScheme(data: $data, schemeId: $schemeId)\n}",
"variables": {
"data": {
"categoryIds": [
"string"
]
},
"schemeId": "string"
}
}
EOF
Variables:
{
"data": {
"categoryIds": [
"string"
]
},
"schemeId": "string"
}
Response:
{
"data": {
"assignCategoriesToScheme": true
}
}
assignCategoriesToScheme(
data: AssignCategoriesDto!
schemeId: String!
): Boolean!
Arguments
assignCategoriesToScheme.data ● AssignCategoriesDto! non-null input
The IDs of the categories the scheme should apply to.
assignCategoriesToScheme.schemeId ● String! non-null scalar
The ID of the discount scheme.
Type
Boolean scalar
The Boolean scalar type represents true or false.