Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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 !!! 😀
Solved! Go to the solution
This is an accepted solution.
Hi,
can you please confirm ?
This is what you have expected ?
Thanks !
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 %}
<div class="pen-case-details">
<h3>{{ product.metafields.custom.pen_case.case_name }}</h3>
<p>{{ product.metafields.custom.pen_case.description }}</p>
{% if product.metafields.custom.pen_case.image %}
<img src="{{ product.metafields.custom.pen_case.image | image_url: width: 500 }}" alt="{{ product.metafields.custom.pen_case.case_name }}">
{% endif %}
</div>
{% 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 %}
<h3>{{ pen_case.case_name.value }}</h3>
<p>{{ pen_case.description.value }}</p>
<img src="{{ pen_case.image | image_url: width: 500 }}" alt="{{ pen_case.case_name.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!
This is an accepted solution.
Hi,
can you please confirm ?
This is what you have expected ?
Thanks !
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025