What this example includes
- Both bases share the same
sizeandcrustgroups. Each option lists the products of both pizzas inproduct_ids. - Large pizzas have an
extra-toppingsmodifier group. Medium pizzas have none. Modifier groups live on the variant products, never on the base. - Size options have an image and a description; crust options don’t.
What the customer sees
Taking the Hawaiian pizza as an example:- The card shows From $12.99. The starting price was omitted, so the sync computed it from the cheapest selectable variant (
haw-m-thin). - The detail view asks Size first, then Crust, and shows modifier groups only after a variant is resolved.
- After Large is picked, Thin disappears because there is no large thin Hawaiian. Thick is then the only option left, so it’s selected automatically.
- After Medium is picked, Thick stays visible but disabled because
haw-m-thickis out of stock. - The cart line is
haw-l-thickat $17.99, plus any extra toppings. Thehawaiianbase never appears in an order.
Request
variants.json
Key points
- The base opens the questions.
hawaiiansetspricing.variant_group_ids: ["size", "crust"]and has emptymodifier_group_ids. - The base price is never charged. Bases use
price: 0here, so the card shows the computed From price (cards show it wheneverstarting_priceis higher thanprice). - Each variant product says how it’s selected.
haw-l-thicksetspricing.variants: [{ "product_id": "hawaiian", "variant_group_option_ids": ["large", "thick"] }], with one option from each of the base’s groups. - Each option lists its products. The
largeoption lists every large pizza of both bases. The sync rejects the payload if an option and a product’spricing.variantsdisagree. - Missing combinations are just omitted. There’s no
haw-l-thin, so customers can’t reach that combination. - Only categories list the base. The variant products aren’t in any category; they’re included in the menu because a base in the menu points to them.
- A product can be a variant of several bases. Add one
pricing.variantsentry per base, each with its own options.
Related
Products — variants
Concepts and validation rules
Multi-level modifier groups
Extras that stack on top of a product