Metafield

Topic summary

A developer is attempting to fetch and display metaobjects from a specific folder (“Johnson Controls”) within Shopify’s “Connections” metaobjects using Liquid templating, but the metaobjects aren’t rendering correctly on the page.

Current approach:

  • Using shop.metaobjects[connection_name] to access metaobjects
  • Implementing debug statements to verify fetched data
  • Filtering metaobjects by company name matching the folder

Code issues identified:

  • The provided code snippet contains corrupted/reversed text segments (e.g., “rofdne”, “fidne”, “eulav”), making portions unreadable
  • The logic attempts to filter metaobjects using a where filter on a ‘company’ field
  • Includes conditional rendering for photos and video elements with click handlers

Status: The issue remains unresolved. The code corruption suggests either a copy-paste error or encoding problem that may be hindering troubleshooting efforts. No responses or solutions have been provided yet.

Summarized with AI on November 7. AI used: claude-sonnet-4-5-20250929.

Hi Shopify Community,

I’m currently working on a project where I need to fetch and display metaobjects from a specific folder in Shopify using Liquid. The folder is named “Johnson Controls” under the “Connections” metaobjects.

Despite my efforts, the metaobjects are not being displayed correctly on the page. I’ve included debug statements to verify the fetched metaobjects, but it still doesn’t seem to work.

Here is the code I’m using

{% assign connection_name = 'connections' %} {% assign folder_name = 'Johnson Controls' %} {% assign metaobjects = shop.metaobjects[connection_name] %}

{% comment %}
Debugging Output: Display all fields of each metaobject
{% endcomment %}

Debug Information

    {% for metaobject in metaobjects %}
  • Name: {{ metaobject.name }}
      {% for field in metaobject %}
    • {{ field[0] }}: {{ field[1] }}
    • {% endfor %}
  • {% endfor %}

{% assign filtered_metaobjects = metaobjects | where: ‘company’, folder_name %}

{% if filtered_metaobjects.size > 0 %}

{% render ‘meta-tags’ %}
{% else %}

No metaobjects found for the specified company.

{% endif %}

{% for metaobject in filtered_metaobjects %}

{% if metaobject.photo.value %} {{ metaobject.name.value }} {% else %}

No photo available for {{ metaobject.name.value }}

{% endif %} {% if metaobject.name.value %}

{{ metaobject.name.value }}

{% endif %} {% if metaobject.job.value %}

{{ metaobject.job.value }}

{% endif %}
{% endfor %}