Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I'm trying to reference information from a metaobject in the custom liquid block for different templates. For instance, I have a metaobject with fields of data that I want to display on a collections page. I know I can use the "connect to dynamic source" option on blocks. But I want to use {{ }} syntax to reference a field in a custom liquid block, as I'm trying to do something specific. The documentation here shows thatI should used the following syntax:
{{ shop.metaobjects.testimonials.homepage.title }} {{ shop.metaobjects['highlights']['washable'].image.value }}
So my syntax comes out to:
<p>{{ shop.metaobjects.mtn_info.beaver_creek.mountain.value }}</p>
But this returns nothing. In fact, I can't get the custom liquid to display any info at all from my metaobject.
I have confirmed and triple checked the type and key names. The only thing I'm not 100% sure about is what the handle is. Is this the same as entry name? I can't find anywhere where it specifically states what the handle is.
Can anyone help please?
Solved! Go to the solution
This is an accepted solution.
Ok the next resource I checked explained that handles use hyphens "-" for spaces so my tag should have been:
<p>{{ shop.metaobjects.mtn_info.beaver-creek.mountain.value }}</p>
I'm leaving this here since I couldn't find that info stated clearly in the metaobject documentation, and hopefully this helps others.
This is an accepted solution.
Ok the next resource I checked explained that handles use hyphens "-" for spaces so my tag should have been:
<p>{{ shop.metaobjects.mtn_info.beaver-creek.mountain.value }}</p>
I'm leaving this here since I couldn't find that info stated clearly in the metaobject documentation, and hopefully this helps others.
We recently spoke with Zopi developers @Zopi about how dropshipping businesses can enha...
By JasonH Oct 23, 2024A big shout out to all of the merchants who participated in our AMA with 2H Media: Holi...
By Jacqui Oct 21, 2024We want to take a moment to celebrate the incredible ways you all engage with the Shopi...
By JasonH Oct 15, 2024