On this page
Why this happens
Reference metafields store relationships, not presentation-ready text. Treating the metafield as a plain string loses the benefit of the typed object.
Implementation
Check the metafield definition in Settings > Custom data. Confirm whether it is a single reference or a list. Use value to obtain the referenced object or iterate over the referenced objects. Guard against empty values and confirm storefront access for referenced metaobjects.
Example
{% assign related = product.metafields.custom.related_product.value %}
{% if related != blank %}
<a href="{{ related.url }}">{{ related.title | escape }}</a>
{% endif %}
For a list of product references, loop over the metafield’s value rather than splitting the stored representation. For metaobject fields, inspect their types and dereference those fields as appropriate.
- Test an empty reference, one populated reference and a list reference
- remove a referenced entry
- check storefront visibility and translated content
- verify the rendered link.

