Skip to main content

Variant specifications

Variants of products, such as different sizes, counts, flavors, and colors, help customers easily compare different versions of the same product. Use variant specifications to group versions of the same product. For example, diapers can be available in different sizes and counts.

Example of variant specifications used for diapers

Variant attributes

FieldTypeRequiredDescription
variant_group_idstringyesThe ID used to match all products that are part of the same variant group.
variant_group_infoJSONyesAn array of JSON objects containing the variant information. For more information, see Data attributes.

Variant group information attributes

FieldTypeRequiredDescription
variant_dimensionstringyesUnique name for this dimension. The value can be any string, but descriptive names are preferred. This value is not displayed on the storefront.
headingstringyesThe user-facing heading under which the different options for a given variant dimension are displayed. For example, “Color” or “Size”.
dataJSONyesAn array of JSON objects describing this variant. For more information, see Data attributes.

Data attributes

FieldTypeRequiredDescription
display_textstringyesThe user-facing text describing the product for this dimension. For example, if the dimension is “color” then the display_text can be “red”.
image_urlstringnoThe URL of an image describing the product for this dimension.
If you use color_hex_code in the column descriptor, you cannot use image_url.
color_hex_codestringnoThe RGB hex code describing the product for this dimension.
if you use image_url in the column descriptor, you cannot use color_hex_code.
orderintnoThe order in which the products for this dimension are displayed to the customer.

Example

 "variant": {
"variant_group_id": "123ABC",
"variant_group_info": [
{
"variant_dimension": "size",
"heading": "Size",
"data": {
"display_text": "S"
}
},
{
"variant_dimension": "color",
"heading": "Color",
"data": {
"display_text": "Red",
"color_hex_code": "#FF0000",
"order": 1
}
},
{
"variant_dimension": "pattern",
"heading": "Pattern",
"data": {
"display_text": "Stripes",
"image_url": "http://example.com/image.jpg"
}
}
]
}