New Shopify Certification now available: Liquid Storefronts for Theme Developers

What syntax should I use to add a metaobject type in input setting schema?

gduverger
Tourist
6 0 7

In my Liquid template, in {% schema %}, I want to add an input setting that references a metaobject.

 

What should the syntax be?

 

I tried,

 

{% schema %}
{
"settings": [
        {
            "type": "testimonial",
            "id": "testimonial"
        }
]
}
{% endschema %}

 

 

And,

 

{
            "type": "shop.metaobjects.testimonial",
            "id": "testimonial"
        }

 

 

As well as,

 

{
            "type": "{{ shop.metaobjects.testimonial }}",
            "id": "testimonial"
        }

 

and a bunch of other syntaxes.

 

I read this doc https://shopify.dev/docs/api/liquid/objects/metaobject but I guess it's still not clear to me.

 

I keep getting an “Unable to update the file” error.

 

Any thoughts?

 

Replies 3 (3)
yadrienne
Shopify Partner
2 0 1

hi, Gduverger, I have the same issue, die you have already the solution? could you please share? thank you in advance!

gduverger
Tourist
6 0 7

No solutions, yet. Sorry.

KS_Callum
Shopify Partner
1 0 0

Hey Gdruverger,

Better late than never but if you haven't found out already you need to use a type of "url" and then select dynamic source. 

https://shopify.dev/docs/themes/architecture/settings/input-settings#url

 

KS_Callum_0-1690162313602.png

The field should appear as this in the theme editor. 

KS_Callum_1-1690162399984.png

 

From there click the highlighted button and either select a metafield or click the link to add a new metafield.