assignProductsToScheme
Requires permission products:discount:update.
Replaces the products a discount scheme applies to with the list given. The existing assignments are removed first, and the scheme and every product 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 AssignProductsToScheme($data: AssignProductsDto!, $schemeId: String!) {
assignProductsToScheme(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 AssignProductsToScheme($data: AssignProductsDto!, $schemeId: String!) {\n assignProductsToScheme(data: $data, schemeId: $schemeId)\n}",
"variables": {
"data": {
"productIds": [
"string"
]
},
"schemeId": "string"
}
}
EOF
Variables:
{
"data": {
"productIds": [
"string"
]
},
"schemeId": "string"
}
Response:
{
"data": {
"assignProductsToScheme": true
}
}
assignProductsToScheme(
data: AssignProductsDto!
schemeId: String!
): Boolean!
Arguments
assignProductsToScheme.data ● AssignProductsDto! non-null input
The IDs of the products the scheme should apply to.
assignProductsToScheme.schemeId ● String! non-null scalar
The ID of the discount scheme.
Type
Boolean scalar
The Boolean scalar type represents true or false.