Meta Objects - struggling to get them displayed on the website

Hello,

I am struggling to to use a Meta Object that I created.

The object itself was easy to build and is pretty basic (Name, Bio, Photo, Website URL), but I can’t figure out how to get them displayed on my site. I tried watching a video on how to implement them, but couldn’t figure it out.

Is there additional documentation or a video you’ve watched that made it all click for you?

I appreciate the ideas and help!

Ekho

Hello Ekho,

you can add them with the Liquid Code:

{{ product.metafields.custom.material }}

“custom.material” is the namespace and key here, which you can find in the metafield settings.

Best regards
Sebastian

Hi Sebastian,

Thank you for the pointer - I do not see the Namespace or Key in the metafield settings. Sorry to be dense…can you provide the clickstream path to find that info?

Ekho

Hey Ekho,

no problem - you can find this in your settings under “Custom data”.

And in the product metafield you have the “Namespace and key”.

Best regards
Sebastian

I wonder if this is a different workflow because I am not using a ‘Product Metafield’.

I created a MetaObject Definition called ‘Past Guests’ and then added the fields I wanted. When I go to ‘Settings’ → ‘Custom Data’ → ‘Meta Object Definition’ → ‘Past Guests’ this is what I see:

Sebastian,

As you can see…I’m not a coder :). However, I wrote the following script…but nothing is displaying. Based on the screenshots in the last post and the code below…are you able to tell what I am doing wrong?

{% for guest in collections.past_guests %}

{{ guest.metafields.past_guests.name.value}}

Bio: {{ guest.metafields.past_guests.bio.value}}

Photo: {{ guest.metafields.past_guests.photo.value}}

Photo: {{ guest.metafields.past_guests.website.value}}

Photo: {{ guest.metafields.past_guests.i_am_ekho_episode.value}}

{% endfor %}

never mind - ChatGPT to the rescue!

For anyone looking for similar code (display is horrible, but it works)

{% for guest in shop.metaobjects.past_guests.values %}

{{ guest.name }}

Bio: {{ guest.bio }}

Photo: {{ guest.name }}

Website: {{ guest.website }}

Episode: {{ guest.i_am_ekho_episode }}

{% endfor %}