younifyd
Menu

variantProjection

A single product-projection variant by SKU or key.

Use it in a workflow

  1. Add a step and choose the Commercetools connector.
  2. Pick the variantProjection action (under Variant).
  3. Fill in the fields below, then reference the result from later steps as {{variantprojection.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 VariantProjection($id: String, $key: String, $sku: String, $staged: Boolean!, $localeProjection: [Locale!]) {
  variantProjection(
    id: $id
    key: $key
    sku: $sku
    staged: $staged
    localeProjection: $localeProjection
  ) {
    id
    staged
    default
    variantId
    version
    createdAt
    productRef {
      typeId
      id
    }
    key
    sku
    images {
      url
      dimensions {
        width
        height
      }
      label
    }
    assets {
      id
      key
      sources {
        uri
        key
        dimensions
        contentType
      }
      nameAllLocales {
        locale
        value
      }
      descriptionAllLocales {
        locale
        value
      }
      tags
      custom {
        typeRef
        type
      }
    }
    nameAllLocales {
      locale
      value
    }
    slugAllLocales {
      locale
      value
    }
    descriptionAllLocales {
      locale
      value
    }
  }
}

Variables

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

idstring

Queries with specified ID

keystring

Queries with specified key

skustring

Queries for a variant projection with specified SKU

stagedbooleanrequired

If true, queries staged projections. If false (default), queries current (published) projections.

localeProjectionarray<string>

Filters localized fields (name, slug, description, attribute labels) to the specified locales

json
{
  "staged": false,
  "id": "string",
  "key": "string",
  "sku": "string",
  "localeProjection": [
    "string"
  ]
}

Response

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

idstring
stagedboolean
defaultboolean
variantIdnumber
versionstring
createdAtstring
productRefobject
typeIdstring
idstring
keystring
skustring
imagesarray<object>
urlobject
dimensionsobject
labelobject
assetsarray<object>
idobject
keyobject
sourcesobject
nameAllLocalesobject
descriptionAllLocalesobject
tagsobject
customobject
nameAllLocalesarray<object>
localeobject
valueobject
slugAllLocalesarray<object>
localeobject
valueobject
descriptionAllLocalesarray<object>
localeobject
valueobject

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

Was this page helpful?