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.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.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.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.query {
products {
results {
key
masterData {
current {
masterVariant {
price(currency: "USD", country: "US") {
value {
centAmount
}
}
}
}
}
}
}
}