Metafield data in custom liquid section

Topic summary

A user encountered an issue accessing metafield data within a Custom Liquid section on a Shopify product page. When attempting to retrieve Instructor metafield information (name, bio, job_title, headshot), they only received a metaobject reference ID instead of the actual data.

Root Cause:
Shopify metaobjects return references by default, not the actual field values. The original code accessed product.metafields.custom.instructor directly, which only returned the GID reference.

Solution:
Access the metaobject using .value to retrieve actual data:

{% assign instructor = product.metafields.custom.instructor.value %}
{{ instructor.name }}
{{ instructor.bio }}

Key Takeaways:

  • No need to create a separate custom section; Custom Liquid blocks work fine with proper syntax
  • Always append .value when accessing metaobject references
  • The solution was confirmed working by the original poster

Status: Resolved

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

I’m having trouble accessing the data in a metafield object from a product page.

I can get at the data from the other sections by connecting data sources to different fields, but I can’t access the data in the metafield within a “Custom Liquid” section for some reason. I’m trying to keep different Instructors in the metafield and I’m attaching them to classes that we are listing as products on our page.

I have a metafield called Instructor, within the instructor metafield, I have name, bio, job_title, headshot, etc…

in a custom liquid section:


all I get is:

{
   instructor: "gid://shopify/Metaobject/89092587776"
}

Am I doing something wrong? Support tried to tell me I should create my own “Custom Liquid Section” and do what I’m trying to do. But I haven’t gotten a straight answer on whether that is true or not. I’m not clear on what is going wrong.

HI @JayMorgan ,

Custom Liquid might not be supported, or there could be an issue with the code syntax.

Please help me by taking screenshots of the instructor section you’re referring to, following the examples here:

Additionally, capture the section where you added the custom Liquid block so I can check further.

Best,

Daisy

Hi @JayMorgan ,

You’re actually on the right track, but Shopify’s metafields for metaobjects behave a bit differently when accessed in Liquid. The issue is that you’re retrieving a metaobject reference instead of the actual metafield values.

### How to Fix It?

To properly access your Instructor metafield data, you need to fetch the referenced metaobject fields.

Try this instead:

{% assign instructor = product.metafields.custom.instructor.value %}

**Name:** {{ instructor.name }}

**Bio:** {{ instructor.bio }}

**Job Title:** {{ instructor.job_title }}

Why Does This Work?- product.metafields.custom.instructor returns a metaobject reference, not the actual data.

  • product.metafields.custom.instructor.value retrieves the actual metaobject, allowing you to access its fields directly.

### Debugging Tip

If you’re still getting a reference instead of data, try logging just the .value:


This should now show the full object instead of just the reference ID.

### Is Shopify Support Right About Creating a Custom Section?

Not necessarily. You don’t need to create a separate section just to access metafields. Using a Custom Liquid block within an existing section should work fine as long as you’re using .value correctly.

Since you’re working with product metafields, it’s also a good idea to ensure your product pages are fully optimized for search engines. Structured data, well-crafted SEO titles, and detailed descriptions can make a big difference in visibility. If you’re looking for a tool that can help audit and bulk-optimize your Shopify product SEO, there are apps like SEOPro that streamline the process.

Hope this helps!

Let me know if you run into issues.

Lily!

1 Like

OMG! That worked. You’re the best. I totally get what you explained! Thank you!

Thanks for the kind words, @JayMorgan ! :blush:

Glad it worked for you—if it solved your issue, feel free to mark it as the accepted solution.

Let me know if you need any more help!