younifyd
Menu

variant

A single product variant by SKU or key.

Use it in a workflow

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

Query

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

graphql
query Variant($sku: String, $stagedSku: String, $id: String, $key: String) {
  variant(sku: $sku, stagedSku: $stagedSku, id: $id, key: $key) {
    productRef {
      typeId
      id
    }
    product {
      id
      key
      version
      productTypeRef {
        typeId
        id
      }
      productType {
        key
        name
        description
        id
        version
        createdAt
        lastModifiedAt
        createdBy
        lastModifiedBy
      }
      masterData {
        current
        staged
        published
        hasStagedChanges
      }
      skus
      createdAt
      lastModifiedAt
      stateRef {
        typeId
        id
      }
      state {
        id
        version
        key
        type
        roles
        nameAllLocales
        descriptionAllLocales
        builtIn
        transitionsRef
        transitions
        initial
        createdAt
        lastModifiedAt
        createdBy
        lastModifiedBy
      }
      priceMode
      taxCategoryRef {
        typeId
        id
      }
      taxCategory {
        name
        description
        rates
        key
        id
        version
        createdAt
        lastModifiedAt
        createdBy
        lastModifiedBy
      }
      reviewRatingStatistics {
        averageRating
        highestRating
        lowestRating
        count
        ratingsDistribution
      }
      createdBy {
        isPlatformClient
        clientId
        externalUserId
        anonymousId
        customerRef
        userRef
        associateRef
        attributedTo
      }
      lastModifiedBy {
        isPlatformClient
        clientId
        externalUserId
        anonymousId
        customerRef
        userRef
        associateRef
        attributedTo
      }
    }
    variantId
    key
    current {
      sku
      images {
        url
        dimensions
        label
      }
      assets {
        id
        key
        sources
        nameAllLocales
        descriptionAllLocales
        tags
        custom
      }
    }
    staged {
      sku
      images {
        url
        dimensions
        label
      }
      assets {
        id
        key
        sources
        nameAllLocales
        descriptionAllLocales
        tags
        custom
      }
    }
    published
    id
    version
    createdAt
    lastModifiedAt
    createdBy {
      isPlatformClient
      clientId
      externalUserId
      anonymousId
      customerRef {
        typeId
        id
      }
      userRef {
        typeId
        id
      }
      associateRef {
        typeId
        id
      }
      attributedTo {
        clientId
        source
        userRef
      }
    }
    lastModifiedBy {
      isPlatformClient
      clientId
      externalUserId
      anonymousId
      customerRef {
        typeId
        id
      }
      userRef {
        typeId
        id
      }
      associateRef {
        typeId
        id
      }
      attributedTo {
        clientId
        source
        userRef
      }
    }
  }
}

Variables

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

skustring

Queries for a current variant with specified SKU

stagedSkustring

Queries for a staged variant with specified SKU

idstring

Queries with specified ID

keystring

Queries with specified key

json
{
  "sku": "string",
  "stagedSku": "string",
  "id": "string",
  "key": "string"
}

Response

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

productRefobject
typeIdstring
idstring
productobject
idstring
keystring
versionstring
productTypeRefobject2 fields
productTypeobject9 fields
masterDataobject4 fields
skusarray<object>
createdAtstring
lastModifiedAtstring
stateRefobject2 fields
stateobject15 fields
priceModestring

One ofEmbeddedStandalone

taxCategoryRefobject2 fields
taxCategoryobject10 fields
reviewRatingStatisticsobject5 fields
createdByobject8 fields
lastModifiedByobject8 fields
variantIdnumber
keystring
currentobject
skustring
imagesarray<object>
assetsarray<object>
stagedobject
skustring
imagesarray<object>
assetsarray<object>
publishedboolean
idstring
versionstring
createdAtstring
lastModifiedAtstring
createdByobject
isPlatformClientboolean
clientIdstring
externalUserIdstring
anonymousIdstring
customerRefobject2 fields
userRefobject2 fields
associateRefobject2 fields
attributedToobject3 fields
lastModifiedByobject
isPlatformClientboolean
clientIdstring
externalUserIdstring
anonymousIdstring
customerRefobject2 fields
userRefobject2 fields
associateRefobject2 fields
attributedToobject3 fields

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

Was this page helpful?