Skip to main content
Version: 3.x

ProductVariant

Represents a version of a product such as different size or color.

type ProductVariant implements Node, ObjectWithMetadata {
id: ID!
privateMetadata: [MetadataItem!]!
privateMetafield(key: String!): String
privateMetafields(keys: [String!]): Metadata
metadata: [MetadataItem!]!
metafield(key: String!): String
metafields(keys: [String!]): Metadata
name: String!
sku: String
product: Product!
trackInventory: Boolean!
quantityLimitPerCustomer: Int
weight: Weight
channel: String
channelListings: [ProductVariantChannelListing!]
pricing(address: AddressInput): VariantPricingInfo
attributes(variantSelection: VariantAttributeScope): [SelectedAttribute!]!
margin: Int
quantityOrdered: Int
revenue(period: ReportingPeriod): TaxedMoney
images: [ProductImage!]
media: [ProductMedia!]
translation(languageCode: LanguageCodeEnum!): ProductVariantTranslation
digitalContent: DigitalContent
stocks(address: AddressInput, countryCode: CountryCode): [Stock!]
quantityAvailable(address: AddressInput, countryCode: CountryCode): Int
preorder: PreorderData
created: DateTime!
updatedAt: DateTime!
}

Fields

id (ID!)

privateMetadata ([MetadataItem!]!)

List of private metadata items. Requires staff permissions to access.

privateMetafield (String)

A single key from private metadata. Requires staff permissions to access.

Tip: Use GraphQL aliases to fetch multiple keys.

Added in Saleor 3.3.

Note: this API is currently in Feature Preview and can be subject to changes at later point.

privateMetafields (Metadata)

Private metadata. Requires staff permissions to access. Use keys to control which fields you want to include. The default is to include everything.

Added in Saleor 3.3.

Note: this API is currently in Feature Preview and can be subject to changes at later point.

metadata ([MetadataItem!]!)

List of public metadata items. Can be accessed without permissions.

metafield (String)

A single key from public metadata.

Tip: Use GraphQL aliases to fetch multiple keys.

Added in Saleor 3.3.

Note: this API is currently in Feature Preview and can be subject to changes at later point.

metafields (Metadata)

Public metadata. Use keys to control which fields you want to include. The default is to include everything.

Added in Saleor 3.3.

Note: this API is currently in Feature Preview and can be subject to changes at later point.

name (String!)

sku (String)

product (Product!)

trackInventory (Boolean!)

quantityLimitPerCustomer (Int)

weight (Weight)

channel (String)

Channel given to retrieve this product variant. Also used by federation gateway to resolve this object in a federated query.

channelListings ([ProductVariantChannelListing!])

List of price information in channels for the product.

Requires one of the following permissions: AUTHENTICATED_APP, AUTHENTICATED_STAFF_USER.

pricing (VariantPricingInfo)

Lists the storefront variant's pricing, the current price and discounts, only meant for displaying.

Destination address used to find warehouses where stock availability for this product is checked. If address is empty, uses Shop.companyAddress or fallbacks to server's settings.DEFAULT_COUNTRY configuration.

attributes ([SelectedAttribute!]!)

List of attributes assigned to this variant.

Define scope of returned attributes.

margin (Int)

Gross margin percentage value.

quantityOrdered (Int)

Total quantity ordered.

Requires one of the following permissions: MANAGE_PRODUCTS.

revenue (TaxedMoney)

Total revenue generated by a variant in given period of time. Note: this field should be queried using reportProductSales query as it uses optimizations suitable for such calculations.

Requires one of the following permissions: MANAGE_PRODUCTS.

images ([ProductImage!])

List of images for the product variant.

media ([ProductMedia!])

List of media for the product variant.

translation (ProductVariantTranslation)

Returns translated product variant fields for the given language code.

A language code to return the translation for product variant.

digitalContent (DigitalContent)

Digital content for the product variant.

Requires one of the following permissions: MANAGE_PRODUCTS.

stocks ([Stock!])

Stocks for the product variant.

Requires one of the following permissions: MANAGE_PRODUCTS, MANAGE_ORDERS.

Destination address used to find warehouses where stock availability for this product is checked. If address is empty, uses Shop.companyAddress or fallbacks to server's settings.DEFAULT_COUNTRY configuration.

Two-letter ISO 3166-1 country code.

DEPRECATED: this field will be removed in Saleor 4.0. Use address argument instead.

quantityAvailable (Int)

Quantity of a product available for sale in one checkout. Field value will be null when no limitQuantityPerCheckout in global settings has been set, and productVariant stocks are not tracked.

Destination address used to find warehouses where stock availability for this product is checked. If address is empty, uses Shop.companyAddress or fallbacks to server's settings.DEFAULT_COUNTRY configuration.

Two-letter ISO 3166-1 country code. When provided, the exact quantity from a warehouse operating in shipping zones that contain this country will be returned. Otherwise, it will return the maximum quantity from all shipping zones.

DEPRECATED: this field will be removed in Saleor 4.0. Use address argument instead.

preorder (PreorderData)

Preorder data for product variant.

Added in Saleor 3.1.

Note: this API is currently in Feature Preview and can be subject to changes at later point.

created (DateTime!)

updatedAt (DateTime!)

Interfaces

Node

An object with an ID

ObjectWithMetadata