ProductVariant Object
Represents a version of a product such as different size or color.
type ProductVariant implements Node, ObjectWithMetadata, ObjectWithAttributes {
id: ID!
privateMetadata: [MetadataItem!]!
privateMetafield(
key: String!
): String
privateMetafields(
keys: [String!]
): Metadata
metadata: [MetadataItem!]!
metafield(
key: String!
): String
metafields(
keys: [String!]
): Metadata
assignedAttribute(
slug: String!
): AssignedAttribute
assignedAttributes(
limit: PositiveInt = 100
): [AssignedAttribute!]!
name: String!
sku: String
product: Product!
trackInventory: Boolean!
quantityLimitPerCustomer: Int
weight: Weight
channel: String
channelListings: [ProductVariantChannelListing!]
pricing(
address: AddressInput
): VariantPricingInfo
attributes(
variantSelection: VariantAttributeScope
): [SelectedAttribute!]! @deprecated
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
}
Fields
id ● ID!
The ID of the product variant.
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.
key ● String!
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.
keys ● [String!]
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.
key ● String!
metafields ● Metadata
Public metadata. Use keys to control which fields you want to include. The default is to include everything.
keys ● [String!]
assignedAttribute ● AssignedAttribute
Get a single attribute attached to product by attribute slug.
Added in Saleor 3.22slug ● String!
Slug of the attribute
assignedAttributes ● [AssignedAttribute!]!
List of attributes assigned to this variant.
Added in Saleor 3.22limit ● PositiveInt
Maximum number of attributes to return. Default is 100.
name ● String!
The name of the product variant.
sku ● String
The SKU (stock keeping unit) of the product variant.
product ● Product!
The product to which the variant belongs.
trackInventory ● Boolean!
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.
quantityLimitPerCustomer ● Int
The maximum quantity of this variant that a customer can purchase.
weight ● Weight
The weight of the product variant.
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.
pricing ● VariantPricingInfo
Lists the storefront variant's pricing, the current price and discounts, only meant for displaying.
address ● AddressInput
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.
margin ● Int
Gross margin percentage value.
quantityOrdered ● Int
Total quantity ordered.
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.
period ● ReportingPeriod
media ● [ProductMedia!]
List of media for the product variant.
translation ● ProductVariantTranslation
Returns translated product variant fields for the given language code.
languageCode ● LanguageCodeEnum!
A language code to return the translation for product variant.
digitalContent ● DigitalContent
Digital content for the product variant.
stocks ● [Stock!]
Stocks for the product variant.
address ● AddressInput
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.
countryCode ● CountryCode
Use address argument instead.
Two-letter ISO 3166-1 country code.
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.
address ● AddressInput
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.
countryCode ● CountryCode
Use address argument instead.
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.
preorder ● PreorderData
Preorder data for product variant.
created ● DateTime!
The date and time when the product variant was created.
updatedAt ● DateTime!
The date and time when the product variant was last updated.
externalReference ● String
External ID of this product.
Show deprecated
Interfaces
Node
An object with an ID
ObjectWithMetadata
ObjectWithAttributes
An object with attributes.
Added in Saleor 3.22Returned By
productVariant query
Member Of
AssignedMultiProductVariantReferenceAttribute object ● AssignedSingleProductVariantReferenceAttribute object ● 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