A product group represents a family of related variants. It should not erase the identity of the particular size, color or configuration a buyer selects. Before generating variant markup, write the actual catalog membership and attach each offer to its intended product.
The entity identity guide explains why different things need deliberate identifiers. This guide implements the narrower ProductGroup-to-variant-to-offer contract. A syntactically valid graph can still advertise the wrong price or a combination the catalog never offered.
The catalog below is entirely fictional. Names, SKUs, prices, availability and URLs are invented teaching inputs. They are not StackM offers, market data or evidence that any physical product can be purchased.
Define the real group before serializing it
Google’s current product variant documentation describes ProductGroup with associated variesBy, hasVariant and productGroupID properties. Review the current requirements and the relevant single-page or multi-page design before applying the example to an actual shop.
In this fictional single-group page, the selectable product URL includes an explicit SKU parameter. Each selected URL must reach the matching variant in the actual implementation. This does not prescribe a canonical policy for every multi-page catalog or authorize stripping meaningful query parameters.
The group identifies the family;the child Product identifies the purchasable variant;the Offer describes that variant’s commercial terms. Do not move one child’s price onto the entire family and imply every other child shares it. Keep supported shared properties at the group level and variant-specific facts with the correct child.
Reconcile the populated catalog matrix
The fictional owner approves exactly three combinations:
| SKU | Color | Size | Hypothetical USD price | Selected URL parameter |
|---|---|---|---|---|
| DP-B-S | Blue | Small | 100.00 | sku=DP-B-S |
| DP-B-M | Blue | Medium | 110.00 | sku=DP-B-M |
| DP-W-S | White | Small | 120.00 | sku=DP-W-S |
Two colors and two sizes do not establish four available products. The White/Medium combination is not in this catalog. A generator that takes the Cartesian product of every attribute value would invent a fourth variant. Expected membership must come from actual approved SKU records.
Keep the complete graph with its offer relationships
This educational graph contains the three expected variants and their own offers. It omits reviews, ratings and invented product identifiers that the fictional source does not establish.
{
"@context": "https://schema.org",
"@type": "ProductGroup",
"@id": "https://catalog.example/panel#group",
"name": "Fictional Desk Panel",
"description": "A fictional desk display offered in the listed color and size combinations.",
"brand": {
"@type": "Brand",
"name": "Example Workshop Devices"
},
"productGroupID": "DP-SET",
"variesBy": [
"https://schema.org/color",
"https://schema.org/size"
],
"url": "https://catalog.example/panel",
"hasVariant": [
{
"@type": "Product",
"@id": "https://catalog.example/panel?sku=DP-B-S#product",
"name": "Fictional Desk Panel Blue Small",
"sku": "DP-B-S",
"color": "Blue",
"size": "Small",
"url": "https://catalog.example/panel?sku=DP-B-S",
"offers": {
"@type": "Offer",
"url": "https://catalog.example/panel?sku=DP-B-S",
"priceCurrency": "USD",
"price": "100.00",
"availability": "https://schema.org/InStock"
}
},
{
"@type": "Product",
"@id": "https://catalog.example/panel?sku=DP-B-M#product",
"name": "Fictional Desk Panel Blue Medium",
"sku": "DP-B-M",
"color": "Blue",
"size": "Medium",
"url": "https://catalog.example/panel?sku=DP-B-M",
"offers": {
"@type": "Offer",
"url": "https://catalog.example/panel?sku=DP-B-M",
"priceCurrency": "USD",
"price": "110.00",
"availability": "https://schema.org/InStock"
}
},
{
"@type": "Product",
"@id": "https://catalog.example/panel?sku=DP-W-S#product",
"name": "Fictional Desk Panel White Small",
"sku": "DP-W-S",
"color": "White",
"size": "Small",
"url": "https://catalog.example/panel?sku=DP-W-S",
"offers": {
"@type": "Offer",
"url": "https://catalog.example/panel?sku=DP-W-S",
"priceCurrency": "USD",
"price": "120.00",
"availability": "https://schema.org/InStock"
}
}
]
}
The query-bearing child URLs are deliberate selectors in this fixture. Their product IDs remain distinct from the group ID. The common parent does not make the children interchangeable, and a matching name string does not establish that an Offer belongs to the correct SKU.
Test membership,attributes and offers independently
First, compare the emitted SKU set with the approved three-SKU set. Report missing, unexpected and repeated children separately. Matching a count of three would not catch a duplicate DP-B-S that displaced DP-W-S.
Second, compare each SKU’s color and size with the source matrix. Then compare price, currency, availability and selected URL under that same SKU. A correct group-level name cannot repair a Blue/Small offer attached to the White/Small child.
Finally, follow each selected URL in an authorized test environment and inspect the actual selected variant. The visible option, displayed terms and emitted child should agree. A generic group page that ignores the SKU parameter can return 200 for every URL while failing the reader’s selection contract.
Keep an independent fixture assertion
The following function checks the printed graph against the approved three-row matrix. It makes no network request and does not establish that the fictional products exist. Decimal comparison preserves equivalent numeric price representations while keeping currency and SKU identity explicit.
from decimal import Decimal
from urllib.parse import urlsplit, parse_qs
def check_group(group):
expected = {
'DP-B-S': ('Blue', 'Small', Decimal('100.00')),
'DP-B-M': ('Blue', 'Medium', Decimal('110.00')),
'DP-W-S': ('White', 'Small', Decimal('120.00'))
}
assert group['productGroupID'] == 'DP-SET'
children = group['hasVariant']
ids = [group['@id']] + [item['@id'] for item in children]
assert len(ids) == len(set(ids)) == 4
skus = [item['sku'] for item in children]
assert len(skus) == len(set(skus)) == 3
assert set(skus) == set(expected)
for item in children:
color, size, amount = expected[item['sku']]
assert (item['color'], item['size']) == (color, size)
offer = item['offers']
assert offer['priceCurrency'] == 'USD'
assert offer['availability'] == 'https://schema.org/InStock'
assert Decimal(str(offer['price'])) == amount
assert offer['url'] == item['url']
assert parse_qs(urlsplit(item['url']).query) == {'sku': [item['sku']]}
return True
Pass the complete printed object as group. The literal expected dictionary is an independent source contract, not another projection of the generated children. Preserve a separately verified variant-selection browser check because this offline function cannot prove what those URLs would display.
Use negative cases that preserve reassuring totals
Duplicate DP-B-S and omit DP-W-S while keeping three child objects. The identity reconciliation must fail. Next, add White/Medium from the attribute cross-product. The unexpected-member check must fail rather than accepting a plausible product.
Then exchange the 100.00 and 120.00 offers between the two Small variants. All three products and all three prices still exist, but the relationship is wrong. The per-SKU offer comparison must detect it. Restore the approved baseline before each mutation.
A fourth case can point every Offer URL at the default variant. That is a destination error even when the remaining data is accurate. Preserve the actual selection behavior rather than assuming a tidy-looking URL selects the intended configuration.
Keep publication scope separate from catalog design
A product-group graph cannot decide whether every filtered collection deserves its own public page. The faceted navigation decision handles that reader and indexing question. Do not create an indexable URL for every theoretical attribute combination just because a serializer can produce one.
The visible-product consistency review remains necessary for the actual terms and availability. A valid vocabulary object is not evidence that a price is approved or stock exists. Retain the catalog owner’s source revision and commercial approval separately from validation.
Close when group membership, variant identity, offer attachment and selected public state agree within the tested design. Record unsupported combinations and unverified branches explicitly. Later merchant-feature eligibility and search appearance require their own current checks;the graph does not guarantee either outcome.
