How do I show a different food label for each variant?
On this page
Use this when the variants of one product are different foods: flavours with different recipes, or pack sizes with different net quantities. If every variant has the same label, you don’t need to do anything: by default every variant shows the product’s label.
The app never decides from option names (such as “Flavour” or “Size”) which variants differ. You choose it per product.
How a variant gets its label
When you choose Variants differ for a product, each variant shows only what you published for it. There are three options:
- The product label: the variant shows the product’s label as it is.
- The product label with its own net quantity: for another pack size of the same recipe. Only the net quantity is the variant’s; every other field (ingredients, allergens, nutrition, translations…) comes from the product label and changes when you change it.
- A label of its own: for another flavour or recipe. The variant inherits nothing from the product, not even allergens or translations.
A variant with nothing published shows no food label to customers. The app never shows the product’s label or another variant’s label in its place, so a customer who picks the vegan flavour never sees the milk flavour’s ingredients. In the theme editor, such a variant shows a note so you can spot it.
Steps
- In the app, open Food labels and click the product.
- Under Variants, pick the variant in Label you are editing. The list shows what each variant shows now: uses the product label, own net quantity, own label or not set.
- Under What this variant shows, choose one of the three options. The table below marks each field Inherited from the product or Set for this variant.
- For a pack size, enter the variant’s Net quantity.
- For a label of its own, fill in the form, or use Start from to copy the product label or another variant’s label (translations included) and change what differs.
- Click Save, then Publish under Publishing in the right-hand column. Variant labels have their own drafts, revisions, Restore previous published version and conflict check, exactly like product labels. The preview shows what customers see for this variant.
- Repeat for each variant. You can prepare variant labels while the product still shows one label for all variants: customers don’t see them yet.
- Under Variants, choose Variants differ and click Apply. The app lists the variants that have nothing published yet; they show no food label until you publish one. To go back, choose All variants share one label: every variant shows the product label again, and the variant labels are kept.
The editor sets up to 100 variants per product.
On your storefront
The Food information block shows the label of the variant in the page address (a link with ?variant=…), or the first available variant, as soon as the page loads. When the customer picks another variant, a small script swaps the label on the page. It reads nothing from our servers: every variant’s label is already in the page. While the theme looks up the variant the customer picked, the label is hidden for a moment rather than showing the previous variant’s.
Supported themes: Dawn and Horizon, Shopify’s free themes. Other themes are not supported for switching the label with the variant. Sold-out variants show their own label too. Back and forward in the browser show the label of the variant in the address.
Other themes
Themes announce a variant change in different ways. The script also listens to common signals, such as the variant:change event, a change of the product form’s variant (id) field and the variant parameter in the page address, so it may work in another theme, but this is not guaranteed. To check your theme:
- Open a product that uses Variants differ on your storefront.
- Pick each variant and check that the food label changes with it.
If the label does not change in your theme:
- Ask your theme developer to dispatch
variant:changeon the document when the variant changes, with the variant in the event:document.dispatchEvent(new CustomEvent('variant:change', { detail: { variant: { id: variantId } } })). Or to callwindow.EtikettoVariantLabels.show(variantId). - Until then, use All variants share one label and create a separate product for each recipe, so each product page shows the right label.
Quick view and quick add pop-ups are not supported: they may not show the food label of the selected variant.
Variants in other places
- Admin product page: the EU food label block counts how the variants are set. On a variant’s page, the block shows the label customers see for that variant and opens it in the app.
- Sidekick: reading a product’s label lists each variant’s label and allergens. Searching for an allergen checks the variants’ labels and names the variants that contain it.
- Home: the Variants without a label row in the Overview counts the variants of products labeled per variant that show customers no food label.
- CSV: see below.
Variant labels in a CSV file
The export and the import template have two columns for variants:
variant_id: empty for the product’s own label. Fill it in to write a variant’s label; the variant must belong to theproduct_idof the same row.variant_override: what the variant shows:inherit(the product label),net_quantity(the product label with the net quantity of this row) orfull(a label of its own, from the label columns of this row). An empty cell on a row withvariant_idmeansfull.
The export writes, after each product labeled per variant, one row per variant with something published. A row with inherit or net_quantity takes everything else from the product: any other label or translation column filled in on that row is reported as an error, never ignored. Variant rows are saved as drafts or published like product rows, with the same check for labels changed in the meantime.
Limits
- The app does not guess which variants share a recipe; you choose for each variant.
- Pack sizes override the net quantity only. If a pack size has different nutrition or ingredients, give it a label of its own.
- Up to 100 variants per product can be set in the editor; the admin block, Sidekick and the catalogue check look at the first 50 variants of each product.