Skip to main content
Version: Canary 🚧

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!] @deprecated
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!
externalReference: String
}
Expand ▼

Fields

ProductVariant.id ● ID! non-null scalar

The ID of the product variant.

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
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
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
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
ProductVariant.metafields.keys ● [String!] list scalar

ProductVariant.name ● String! non-null scalar

The name of the product variant.

ProductVariant.sku ● String scalar

The SKU (stock keeping unit) of the product variant.

ProductVariant.product ● Product! non-null object

The product to which the variant belongs.

ProductVariant.trackInventory ● Boolean! non-null scalar

Determines if the inventory of this variant should be tracked. If false, the quantity won't change when customers buy this item. If the field is not provided, Shop.trackInventoryByDefault will be used.

ProductVariant.quantityLimitPerCustomer ● Int scalar

The maximum quantity of this variant that a customer can purchase.

ProductVariant.weight ● Weight object

The weight of the product variant.

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.channelListings ● [ProductVariantChannelListing!] list object

List of price information in channels for the product.

Requires one of the following permissions: AUTHENTICATED_APPAUTHENTICATED_STAFF_USER

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.quantityOrdered ● Int scalar

Total quantity ordered.

Requires MANAGE_PRODUCTSpermission.

ProductVariant.revenue ● TaxedMoney object

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 MANAGE_PRODUCTSpermission.
ProductVariant.revenue.period ● ReportingPeriod enum

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.digitalContent ● DigitalContent object

Digital content for the product variant.

Requires MANAGE_PRODUCTSpermission.

ProductVariant.stocks ● [Stock!] list object

Stocks for the product variant.

Requires one of the following permissions: MANAGE_PRODUCTSMANAGE_ORDERS
ProductVariant.stocks.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.stocks.countryCode ● CountryCode enum

Two-letter ISO 3166-1 country code.

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

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

The date and time when the product variant was created.

ProductVariant.updatedAt ● DateTime! non-null scalar

The date and time when the product variant was last updated.

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 ● CheckoutLineProblemInsufficientStock object ● DigitalContent object ● DigitalContentCreate object ● DigitalContentDelete object ● DigitalContentUpdate object ● OrderLine object ● Product object ● ProductVariantBackInStock object ● ProductVariantBulkCreate object ● ProductVariantBulkResult object ● ProductVariantChannelListingUpdate object ● ProductVariantCountableEdge object ● ProductVariantCreate object ● ProductVariantCreated object ● ProductVariantDelete object ● ProductVariantDeleted object ● ProductVariantMetadataUpdated object ● ProductVariantOutOfStock object ● ProductVariantPreorderDeactivate object ● ProductVariantReorderAttributeValues object ● ProductVariantStocksCreate object ● ProductVariantStocksDelete object ● ProductVariantStocksUpdate object ● ProductVariantStockUpdated object ● ProductVariantTranslatableContent object ● ProductVariantTranslate object ● ProductVariantUpdate object ● ProductVariantUpdated object ● Stock object ● VariantMediaAssign object ● VariantMediaUnassign object

Implemented by

_Entity union


Was this page helpful?