EU compliance5 min read
Allergen Metaobject Shows Nothing on the Product Page? Fix or Skip It
Allergen metafield prints GIDs or nothing on your Shopify product page? Why metaobject references need extra Liquid, and how to show allergens without it.
In this guide
- Why does my allergen metafield show GIDs with a bunch of numbers?
- Why does the allergen block show nothing at all?
- How do I print allergen names from a metaobject in Liquid?
- Is a separate allergen list enough for EU food rules?
- Fix the Liquid or use a label block?
- How to show allergens without Liquid
- FAQ
- Show allergens on your product page without Liquid
If your allergen metafield shows nothing on the product page, or prints strings like gid://shopify/Metaobject/123456, the field is a list of metaobject references, not text. Liquid has to load each referenced entry and print one of its fields; printing the metafield directly gives you IDs, and an entry the storefront can’t read gives you nothing. You can fix that with a few lines of Liquid, or skip the metaobject step and show the allergens in bold inside the ingredient list with a theme block.
This guide covers both: why it happens, how to check it, and when moving the food information out of theme code is the simpler route.
Why does my allergen metafield show GIDs with a bunch of numbers?
A metaobject reference stores a pointer to an entry, not the entry’s words. That pointer is a global ID (GID). When a theme or snippet outputs the metafield as if it were text, Liquid prints the pointers:
gid://shopify/Metaobject/123456789, gid://shopify/Metaobject/987654321
The allergen names (“Milk”, “Gluten”) live inside each metaobject entry, in one of its fields. To print them, the code has to read .value, loop over the entries and output the field that holds the name.
Why does the allergen block show nothing at all?
When the output is blank rather than GIDs, the lookup is failing earlier. The usual causes:
- The product has no value. The template is shared, so a product without allergens still shows the heading with nothing under it.
- Wrong namespace or key. One character off and Liquid returns blank. Copy both from the metafield definition under Settings > Custom data.
- The metaobject entries aren’t readable on the storefront. Check the metaobject definition’s access settings and that the entries themselves are active.
- The code prints the wrong field. If the loop outputs a field name the entry doesn’t have, each item renders empty.
- A theme text block can’t show the list. A list of references may not connect to a plain text setting the way a single-line text field does.
- You’re editing a different template. If the product uses an alternate template, the block you changed isn’t on it.
How do I print allergen names from a metaobject in Liquid?
If you want to keep the metaobject setup, these are the steps.
- Open Settings > Custom data > Products, find the allergen metafield and note its namespace and key, and that its type is a list of metaobject references.
- Open the metaobject definition it points to and note the field that holds the display name.
- In a custom Liquid block on the product template, load the entries and print that field. Replace
custom.allergensandlabelwith what you found in steps 1 and 2:
{% assign allergens = product.metafields.custom.allergens.value %}
{% if allergens != blank %}
<p>Contains:
{% for allergen in allergens %}
{{ allergen.label }}{% unless forloop.last %}, {% endunless %}
{% endfor %}
</p>
{% endif %}
- Save, then open a product that has allergens set in a private window.
- If it is still empty, check the metaobject access settings and entry status from the list above.
For other empty-field causes, such as variant versus product metafields or rich text types, see our guide to nutrition and allergen metafields not showing.
Is a separate allergen list enough for EU food rules?
Usually not on its own. Regulation (EU) No 1169/2011 asks for allergens to be emphasised within the ingredient list, so a buyer sees them in context, together with the nutrition table and the food business operator. A “Contains: milk, gluten” line built from a metaobject is a second list next to the ingredients, and you still need Liquid or HTML to make the allergens bold inside the ingredient text.
That is where the snippets from forum threads stack up: one for the metaobject loop, one for bold words, one for the nutrition rows. Each is another place for a value to go missing after a theme update. Our guide to EU allergen information for online food shops covers what the page has to show.
Fix the Liquid or use a label block?
| Metaobject + Liquid | Etiketto Food information block | |
|---|---|---|
| Where allergens are entered | Metaobject entries, referenced from each product | One form per product |
| How allergens appear | A list you print with a loop | In bold inside the ingredient list |
| Theme code | Custom Liquid you maintain | No theme code changes |
| Nutrition table and operator | Separate fields and code | Same form, same block |
| After a theme change | Re-add and re-check the snippet | Add the block to the new theme’s product template |
How to show allergens without Liquid
With Etiketto: EU Nutrition Labels the food information is entered in the app and shown by its own theme block, so there are no references to resolve:
- Fill in one form per product. Enter the ingredients, nutrition per 100 g and the operator from your own specification or lab results.
- Mark the allergens. Wrap each one in asterisks in the ingredient list, for example
oat flakes, honey, *butter* (*milk*). The marked words show in bold on the product page. - Add the block. In the theme editor, add the Food information block to the product template of your Online Store 2.0 theme, such as Dawn, and pick a layout.
- Check one product. Open it on the storefront and confirm the ingredients, allergens and nutrition table read as you entered them.
The block renders plain HTML text, not an image, so search engines and screen readers read it like the rest of the page. The app does not read your existing allergen metaobjects and it does not detect allergens: only the words you mark are bold, and you are responsible for the values being correct for your products.
If you also sell in other languages, see showing allergens in your store’s languages. More on the Etiketto app page.
FAQ
Why are my allergen outputs GIDs?
The metafield is a list of metaobject references. Printing it directly outputs the entry IDs; you need .value and a loop that prints a field of each entry.
Can I keep my allergen metaobjects and use Etiketto?
Yes, but Etiketto doesn’t read them. You enter the ingredients with allergens marked in its form, and its block shows them. You can remove the old snippet once the block shows what you need.
Do I need to edit theme code to use Etiketto?
No. You add the Food information block to the product template in the theme editor. It needs an Online Store 2.0 theme.
Does the app work out which ingredients are allergens?
No. Only the words you wrap in asterisks are shown in bold. What you enter decides what the buyer sees.
Show allergens on your product page without Liquid
Etiketto: EU Nutrition Labels is a free app for food shops selling into the EU. It shows the food information Regulation (EU) No 1169/2011 requires on your product pages: a nutrition table, ingredients with allergens in bold, and the operator.
Install Etiketto: EU Nutrition Labels from the Shopify App Store, fill in your first product, and add the Food information block to your product page.