Is possible combine metafields with metaobjects in liquid?

Topic summary

Goal: Use values from a product/customer metafield to fetch and render related metaobject data in Liquid.

Key points

  • Metafields are key-value data on resources; metaobjects are structured records addressed by handle and accessed via shop.metaobjects.
  • Original attempt split a comma-separated metafield (e.g., “first-feature,second-feature”) and tried shop.metaobjects[‘main_features’][key].text, but returned empty.
  • One reply notes you can’t directly “combine” metafields and metaobjects, yet suggests a workable pattern: split the metafield into keys, fetch each metaobject via shop.metaobjects[‘main_features’][feature_key], then output its properties if found.

Related case

  • A user’s customer metafield (list of metaobjects of type license with fields reference_product and license_files) failed when looping licenses = customer.metafields.custom.license_new.value and accessing license.reference_product.value. A simpler metafield with a list of files worked when iterating and outputting file IDs.

Additional suggestion

  • If a metafield directly references a single metaobject, use metafield.value and output its fields (e.g., feature.value.text). This doesn’t apply to comma-separated strings.

Status: No confirmed solution; code snippets are central; issue remains open.

Summarized with AI on January 13. AI used: gpt-5.

hello there

Unfortunately, this is not possible in Liquid as metafields and metaobjects are two separate entities. Metafields are simply key-value pairs that can be associated with various Shopify resources, while metaobjects are more complex data structures that allow you to define custom data types and store more structured data.

To retrieve the value of a metaobject, you would need to use the shop.metaobjects object followed by the handle of the metaobject, then the name of the property you want to retrieve. For example:

{% assign feature_keys = product.metafield.custom.features | split: ',' %}
{% for feature_key in feature_keys %}
  {% assign feature = shop.metaobjects['main_features'][feature_key] %}
  {% if feature %}
    {{ feature.text }}
  {% endif %}
{% endfor %}

This code loops over each feature key in the features metafield, retrieves the corresponding metaobject using the shop.metaobjects object, and then outputs the text attribute of that metaobject if it exists.