Skip to main content

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
pricing(address: AddressInput): VariantPricingInfo
attributes(variantSelection: VariantAttributeScope): [SelectedAttribute!]!
margin: Int
images: [ProductImage!] @deprecated
media: [ProductMedia!]
translation(languageCode: LanguageCodeEnum!): ProductVariantTranslation
quantityAvailable(address: AddressInput, countryCode: CountryCode): Int
preorder: PreorderData
created: DateTime!
updatedAt: DateTime!
externalReference: String
}

Fields

ProductVariant.id ● ID! non-null scalar

ProductVariant.privateMetadata ● [MetadataItem!]! non-null object

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

ProductVariant.privateMetafield ● String scalar

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

Tip: Use GraphQL aliases to fetch multiple keys.

Added in Saleor 3.3
This API is currently in Feature Preview and can be subject to changes at later point.
ProductVariant.privateMetafield.key ● String! non-null scalar

ProductVariant.privateMetafields ● Metadata scalar

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
This API is currently in Feature Preview and can be subject to changes at later point.
ProductVariant.privateMetafields.keys ● [String!] list scalar

ProductVariant.metadata ● [MetadataItem!]! non-null object

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

ProductVariant.metafield ● String scalar

A single key from public metadata.

Tip: Use GraphQL aliases to fetch multiple keys.

Added in Saleor 3.3
This API is currently in Feature Preview and can be subject to changes at later point.
ProductVariant.metafield.key ● String! non-null scalar

ProductVariant.metafields ● Metadata scalar

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

Added in Saleor 3.3
This API is currently in Feature Preview and can be subject to changes at later point.
ProductVariant.metafields.keys ● [String!] list scalar

ProductVariant.name ● String! non-null scalar

ProductVariant.sku ● String scalar

ProductVariant.product ● Product! non-null object

ProductVariant.trackInventory ● Boolean! non-null scalar

ProductVariant.quantityLimitPerCustomer ● Int scalar

ProductVariant.weight ● Weight object

ProductVariant.channel ● String scalar

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

ProductVariant.pricing ● VariantPricingInfo object

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

ProductVariant.pricing.address ● AddressInput input

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.

ProductVariant.attributes ● [SelectedAttribute!]! non-null object

List of attributes assigned to this variant.

ProductVariant.attributes.variantSelection ● VariantAttributeScope enum

Define scope of returned attributes.

ProductVariant.margin ● Int scalar

Gross margin percentage value.

ProductVariant.images ● [ProductImage!] deprecated list object

DEPRECATED

This field will be removed in Saleor 4.0. Use the media field instead.

List of images for the product variant.

ProductVariant.media ● [ProductMedia!] list object

List of media for the product variant.

ProductVariant.translation ● ProductVariantTranslation object

Returns translated product variant fields for the given language code.

ProductVariant.translation.languageCode ● LanguageCodeEnum! non-null enum

A language code to return the translation for product variant.

ProductVariant.quantityAvailable ● Int scalar

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.

ProductVariant.quantityAvailable.address ● AddressInput input

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.

ProductVariant.quantityAvailable.countryCode ● CountryCode enum

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.

ProductVariant.preorder ● PreorderData object

Preorder data for product variant.

Added in Saleor 3.1

ProductVariant.created ● DateTime! non-null scalar

ProductVariant.updatedAt ● DateTime! non-null scalar

ProductVariant.externalReference ● String scalar

External ID of this product.

Added in Saleor 3.10

Interfaces

Node interface

An object with an ID

ObjectWithMetadata interface

Returned by

productVariant query

Member of

CheckoutLine object ● DigitalContent object ● OrderLine object ● Product object ● ProductVariantCountableEdge object

Implemented by

_Entity union


Was this page helpful?