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
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 miscellaneous

The ID of the product variant.

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

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

ProductVariant.privateMetafield ● String scalar miscellaneous

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 miscellaneous

ProductVariant.privateMetafields ● Metadata scalar miscellaneous

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 miscellaneous

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

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

ProductVariant.metafield ● String scalar miscellaneous

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 miscellaneous

ProductVariant.metafields ● Metadata scalar miscellaneous

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 miscellaneous

ProductVariant.name ● String! non-null scalar miscellaneous

The name of the product variant.

ProductVariant.sku ● String scalar miscellaneous

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

ProductVariant.product ● Product! non-null object products

The product to which the variant belongs.

ProductVariant.trackInventory ● Boolean! non-null scalar miscellaneous

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 miscellaneous

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

ProductVariant.weight ● Weight object miscellaneous

The weight of the product variant.

ProductVariant.channel ● String scalar miscellaneous

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 products

List of price information in channels for the product.

Requires one of the following permissions: AUTHENTICATED_APPAUTHENTICATED_STAFF_USER

ProductVariant.pricing ● VariantPricingInfo object products

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

ProductVariant.pricing.address ● AddressInput input miscellaneous

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 attributes

List of attributes assigned to this variant.

ProductVariant.attributes.variantSelection ● VariantAttributeScope enum products

Define scope of returned attributes.

ProductVariant.margin ● Int scalar miscellaneous

Gross margin percentage value.

ProductVariant.quantityOrdered ● Int scalar miscellaneous

Total quantity ordered.

Requires MANAGE_PRODUCTSpermission.

ProductVariant.revenue ● TaxedMoney object miscellaneous

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 miscellaneous

ProductVariant.images ● [ProductImage!] deprecated list object products

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 products

List of media for the product variant.

ProductVariant.translation ● ProductVariantTranslation object products

Returns translated product variant fields for the given language code.

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

A language code to return the translation for product variant.

ProductVariant.digitalContent ● DigitalContent object products

Digital content for the product variant.

Requires MANAGE_PRODUCTSpermission.

ProductVariant.stocks ● [Stock!] list object products

Stocks for the product variant.

Requires one of the following permissions: MANAGE_PRODUCTSMANAGE_ORDERS
ProductVariant.stocks.address ● AddressInput input miscellaneous

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 miscellaneous

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 miscellaneous

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 miscellaneous

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 miscellaneous

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 products

Preorder data for product variant.

Added in Saleor 3.1

ProductVariant.created ● DateTime! non-null scalar miscellaneous

The date and time when the product variant was created.

ProductVariant.updatedAt ● DateTime! non-null scalar miscellaneous

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

ProductVariant.externalReference ● String scalar miscellaneous

External ID of this product.

Added in Saleor 3.10

Interfaces

Node interface miscellaneous

An object with an ID

ObjectWithMetadata interface miscellaneous

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