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.
Variant attributes
Field | Type | Required | Description |
---|---|---|---|
variant_group_id | string | yes | The ID used to match all products that are part of the same variant group. |
variant_group_info | JSON | yes | An array of JSON objects containing the variant information. For more information, see Data attributes. |
Variant group information attributes
Field | Type | Required | Description |
---|---|---|---|
variant_dimension | string | yes | Unique name for this dimension. The value can be any string, but descriptive names are preferred. This value is not displayed on the storefront. |
heading | string | yes | The user-facing heading under which the different options for a given variant dimension are displayed. For example, “Color ” or “Size”. |
data | JSON | yes | An array of JSON objects describing this variant. For more information, see Data attributes. |
Data attributes
Field | Type | Required | Description |
---|---|---|---|
display_text | string | yes | The user-facing text describing the product for this dimension. For example, if the dimension is “color” then the display_text can be “red”. |
image_url | string | no | The 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_code | string | no | The RGB hex code describing the product for this dimension. if you use image_url in the column descriptor, you cannot use color_hex_code . |
order | int | no | The 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"
}
}
]
}