Product Projections

Ask about this Page
Copy for AI
View as Markdown
Query and retrieve Product Projections with the GraphQL API.

Queries

Query Product Projections

You can retrieve Product Projections with Query Products. Find on this page how to select the current or staged Product Projection, project by locale, and apply price selection with the products query.

Get Product Projection

To retrieve the projection of a single Product, use the Get Product query and select the current or staged Projection in masterData. The product query also supports the localeProjection and projectExpandedProducts arguments.
Example query to retrieve the current Product Projection of a Product by keygraphql
query {
  product(key: "my-product-key") {
    id
    masterData {
      current {
        name(locale: "en")
        slug(locale: "en")
      }
    }
  }
}

Projection options

Select the current or staged Product Projection

A published Product has a current Product Projection, and every Product has a staged Product Projection. Select the current field to retrieve published data, or the staged field to retrieve data that includes unpublished changes.
Example query to select the current and staged Product Projectiongraphql
query {
  products(limit: 20) {
    total
    results {
      key
      masterData {
        published
        hasStagedChanges
        current {
          name(locale: "en")
        }
        staged {
          name(locale: "en")
        }
      }
    }
  }
}

Project by locale

Use the localeProjection argument to filter localized fields, such as nameAllLocales, to the specified locales. All other locales are removed from the response. If a field has no translation for the requested locales, the API falls back to the Project languages in the order configured on the Project.
Example query to project Products on a localegraphql
query {
  products(localeProjection: ["de"]) {
    results {
      key
      masterData {
        current {
          nameAllLocales {
            locale
            value
          }
        }
      }
    }
  }
}

Apply price selection

You can apply price selection on a Product Variant with the price field. The arguments have similar names to the Products API, but without the price prefix. For example, use currency and country instead of priceCurrency and priceCountry.
Example query to apply price selectiongraphql
query {
  products {
    results {
      key
      masterData {
        current {
          masterVariant {
            price(currency: "USD", country: "US") {
              value {
                centAmount
              }
            }
          }
        }
      }
    }
  }
}