younifyd
Menu

bulkUpdateVariants

Apply the same set of variant update actions to many product variants in one call.

Use it in a workflow

  1. Add a step and choose the Commercetools connector.
  2. Pick the bulkUpdateVariants action (under Bulk).
  3. Fill in the fields below, then reference the result from later steps as {{bulkupdatevariants.response.data}}.

Query

This is the mutation the action sends by default. Edit it in the step's Query field to change which fields come back.

graphql
mutation BulkUpdateVariants($input: BulkUpdateVariantsInput!) {
  bulkUpdateVariants(input: $input) {
    successCount
    failureCount
    results {
      status
      resource {
        id
        version
      }
      errors {
        code
        message
      }
    }
  }
}

Variables

Pass these as a JSON object in the step's Variables field.

inputobjectrequired
itemsarray<object>required3 fields
actionsarray<object>required2 fields
versionControlstring

One ofOnOff

json
{
  "input": {
    "items": [
      {
        "id": "string",
        "key": "string",
        "version": "string"
      }
    ],
    "actions": [
      {
        "publish": "string",
        "unpublish": "string"
      }
    ],
    "versionControl": "On"
  }
}

Response

Read the result with {{bulkupdatevariants.response.data.data.bulkUpdateVariants}}. If the API returns errors, the step fails and they are at {{bulkupdatevariants.response.data.errors}}.

successCountnumber
failureCountnumber
resultsarray<object>
statusobject
resourceobject
errorsobject

Need more? See the Commercetools guide for connection setup and behaviour shared by every action.

Was this page helpful?
bulkUpdateVariants — Commercetools — Documentation