Help using nested metaobjects and liquid code

Topic summary

A user is attempting to display nested metaobject data on a Shopify product page for a pen store. The setup involves a product metafield linking to a “Pen Cases” metaobject, which contains fields like case_name, image, and description.

Initial Problem:
The user struggled with the correct Liquid syntax to access nested metaobject fields, trying variations like {{ products.metafields.custom.pen_case.case_name.value }}.

Troubleshooting Steps:

  • A helper provided corrected code using {{ product.metafields.custom.pen_case.case_name }} (without .value for metaobject references)
  • When this didn’t work, an alternative approach was suggested using {% assign %} with explicit .value accessors
  • Multiple code snippets were shared, including conditional checks and image rendering

Current Status:
The issue remains unresolved after trying suggested solutions. The helper requested collaborator access to the Shopify store to diagnose the configuration directly. Screenshots were shared showing how to generate the collaborator access code, and the helper appears to have accessed the store, posting a screenshot asking for confirmation that the displayed result matches expectations.

Summarized with AI on October 28. AI used: claude-sonnet-4-5-20250929.

Hi Guys,

Please forgive this - I’m sure it will be an easy answer and I’m probably just an idiot but I’m new to all this stuff.

So I am putting together a site selling pens - all of the pen types that I’m selling have their fields in a metaobject, so they have

Name

Type of Pen

Image

Description

Default Case - Links to the Pen Cases metaobject

So what I want to do is - on the product page - display all the relevant details of the product but also the default case details.

So I have a metafield called Pen Case which is linked to the Pen Cases metaobject which has the following fields in it

Case Name
Image

Description

So on my product page I’l trying to add a bit of liquid code to display the Default case for that pen type - I’d like to add the image too but first things first.

so my simplistic understanding of the liquid code would suggest I just need to add

{{ products.metafields.custom.pen_case.value }} but I figure this will just give me a pointed to another metaobject so I figure I need to go in further and have tried

{{ products.metafields.custom.pen_case.case_name.value }}

It feels like I’ve tried every combination but I’m worried that I have a fundamental misunderstanding of how this data can be used.

HELP !!! :grinning_face:

Hi

when you have a metaobject reference, you need to access its fields like this:

{{ product.metafields.custom.pen_case.case_name }}

So on your product page, you should write:

{% if product.metafields.custom.pen_case %}
  
    ### {{ product.metafields.custom.pen_case.case_name }}
    

{{ product.metafields.custom.pen_case.description }}

    {% if product.metafields.custom.pen_case.image %}
      
    {% endif %}
  

{% endif %}

Let me know if this is not solving your problem.

ok - tried that, no joy - I’ve checked that the names used are the ones I’ve said - I can’t see a typo anywhere - I’m stumped as to how to debug it to be honest. Anything else that could be impacting it ?

Anyone got any further ideas - I haven’t managed to spot what the problem is - Is there anything that I can upload to assist diagnosis?

You should try this

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

{% if pen_case %}
  ### {{ pen_case.case_name.value }}
  

{{ pen_case.description.value }}

  
{% endif %}

if this is not working then might be I need Collab access to check everything is set properly.

Hi - no that didn’t work - how do I sort out collab access ?

Thanks for your assist

I need your store url and collab access code.

Hi

Here are the steps to provide the collaborator access code.

Thanks!

Hi,

can you please confirm ?
This is what you have expected ?

Thanks !

1 Like