To describe size and colour variants with schema, wrap them in one ProductGroup and list each sellable version as a Product under hasVariant. Name the differing attributes in variesBy and give the group a unique ID with productGroupID. Google documents this pattern for grouping variants such as size and colour [1], and says the markup can make products eligible to show with variant information in merchant listing experiences [1].
This article covers the structure, a working JSON-LD example, the Google features involved, and the mistakes that break the grouping. It makes no claims about AI answers. The notes behind this article contain no vendor documentation tying variant markup to AI citations.
What ProductGroup is for
Schema.org defines ProductGroup as a group of products that vary only in well-described ways, such as size, color or material [4]. A T-shirt sold in three sizes and two colours is one product group with six variants. Six unrelated products that happen to look alike are not.
The properties that do the work:
| Property | Sits on | What it does |
|---|---|---|
ProductGroup | The parent node | The type for the shared product |
hasVariant | ProductGroup | Lists the Product members of the group [4] |
variesBy | ProductGroup | Names the property or properties the variants differ by [4] |
productGroupID | ProductGroup | A unique ID for the group [1] |
inProductGroupWithID | Variant Product | Ties a variant to a group by the same ID [1] |
isVariantOf | Variant Product | The inverse of hasVariant [4]; Google added it to its product structured data documentation in 2026 [5] |
Google says each product group must have a unique ID, supplied as productGroupID on the ProductGroup or inProductGroupWithID on the variant Product items [1].
A working example
This example is a T-shirt in two sizes and two colours. Each variant has its own SKU, URL and offer. Only two of the four variants are shown, to keep it short.
{
"@context": "https://schema.org",
"@type": "ProductGroup",
"name": "Harbor Crew Tee",
"description": "Midweight cotton crew-neck T-shirt.",
"brand": { "@type": "Brand", "name": "Example Apparel" },
"productGroupID": "harbor-crew-tee",
"variesBy": ["size", "color"],
"url": "https://www.example.com/harbor-crew-tee",
"hasVariant": [
{
"@type": "Product",
"name": "Harbor Crew Tee, Navy, M",
"sku": "HCT-NAVY-M",
"color": "Navy",
"size": "M",
"image": "https://www.example.com/img/hct-navy.jpg",
"url": "https://www.example.com/harbor-crew-tee?color=navy&size=m",
"offers": {
"@type": "Offer",
"price": "29.00",
"priceCurrency": "USD",
"availability": "https://schema.org/InStock",
"url": "https://www.example.com/harbor-crew-tee?color=navy&size=m"
}
},
{
"@type": "Product",
"name": "Harbor Crew Tee, Sand, L",
"sku": "HCT-SAND-L",
"color": "Sand",
"size": "L",
"image": "https://www.example.com/img/hct-sand.jpg",
"url": "https://www.example.com/harbor-crew-tee?color=sand&size=l",
"offers": {
"@type": "Offer",
"price": "29.00",
"priceCurrency": "USD",
"availability": "https://schema.org/OutOfStock",
"url": "https://www.example.com/harbor-crew-tee?color=sand&size=l"
}
}
]
}
Notes on the example:
variesByis shown as plain text names. Schema.org also allows variant properties to be given asPropertyValueto spell out the available values [4]. Check the exact value format against the example in Google's product variants documentation [1] before you ship.- The variant
colorandsizevalues should match what a shopper sees on the page. - Every variant carries its own price and availability. The Sand/L variant is out of stock while Navy/M is in stock, and the markup says so.
- Google's documentation lists the required and recommended properties for products and offers [2]. Use it as the checklist for what each variant node needs.
Multi-page vs single-page stores
How you structure the markup depends on how your store serves variants.
Each variant has its own URL. Google's documentation says multi-page sites need full, self-contained markup on each page [3]. Each variant page should carry the complete ProductGroup markup, not a fragment that depends on another page.
All variants live on one URL. Google says there must be only one distinct canonical URL for the overall ProductGroup that all variants belong to [1]. Google also says the site must be able to preselect each variant directly with a distinct URL, so Google can crawl and identify each variant [3]. In the example above, that is the query-string pattern ?color=navy&size=m.
If your variant URLs are parameter-based, decide deliberately which URL is canonical for each page before you add markup. The canonical tags guide covers how Google weighs canonical signals.
Which Google features this supports
Google's documentation supports the following:
- Variant markup can make products eligible for display with variant information in merchant listing experiences [1].
- Merchant listing structured data can appear in the shopping knowledge panel, Google Images, popular product results and product snippets [2].
- Product rich results and merchant listings are for pages focused on a single product or multiple variants of the same product, not general category pages [2].
The last point matters for small shops. Put ProductGroup markup on the product page, not on a collection page that lists many different products. Eligibility is not a guarantee. The documentation describes what can appear, and nothing in it promises placement, rankings or traffic.
Common mistakes
- Marking up a category page. Google says these features cover single products and variants of one product, not category pages [2].
- **Injecting
Productmarkup only with JavaScript.** Google's documentation says JavaScript-generatedProductmarkup can make Shopping crawls less frequent and less reliable [3]. If your platform allows it, output the JSON-LD in the server-rendered HTML. - No unique group ID. Without a
productGroupIDor matchinginProductGroupWithIDvalues, there is nothing connecting the variants [1]. - Changing the ID between deploys. This is general practice, not a documented Google rule. Derive the ID from something stable, like a base SKU, not a database row number that can change on re-import.
- Markup that disagrees with the page. If the page shows $29 and the markup says $27, fix the data source. Generate both from the same field.
- Invalid JSON that silently drops the block. A trailing comma is enough. See JSON-LD errors that hide your structured data for the usual causes.
How to test it
- Paste the page URL or the rendered HTML into Google's Rich Results Test and confirm the product items are detected.
- View the page source, not just the browser inspector, and confirm the JSON-LD is in the HTML your server sends.
- Open each variant URL directly, in a private window, and confirm it loads the right size and colour preselected [3].
- After Google has recrawled, check the Search Console enhancement and merchant reports for errors on your product pages.
If you also publish return terms, those are a separate node. The MerchantReturnPolicy guide covers it. To tie the product, organization and page nodes together with @id, see the JSON-LD @id guide.
What to do next
- List your products that have more than one size, colour or material, and pick one stable group ID for each.
- Confirm each variant can be reached by a distinct URL that preselects it.
- Generate the
ProductGroupJSON-LD from your product data, server-side, and compare it against Google's current product variants documentation [1]. - Run the Rich Results Test on one product per template, fix errors, then roll out.