Programmatically create theme template for metaobject definition

My app displays metaobject data on the storefront, however there is no way to do this until the app user has manually created a theme template for the metaobject definition.

  • the app can create metaobject definitions programmatically, however it does not come with a default theme template

  • the app cannot programmatically create a template for the metaobject without “write_themes” scope (the new rule)

  • the app can deep link the user to the theme editor, however the template does not exist yet for the metaobject, so that doesn’t work

  • this means that the app needs to ask the user to manually create a template in the editor. Afterwards, deep linking will work but theres hardly any point now that the user is already there in the new template

Am I understanding all this correctly? Has anyone dealt with this situation before? How did you handle it? Ultimately, I would like to make this as easy as possible for the user.

Hi @ryandavisdev ,

I hope you are doing well.

If your app creates layout/template files, you can request exempt to use write_themes scope. I think your usecase could be page builder or repeat block. here the docs if you havent seen it: https://shopify.dev/docs/apps/build/online-store/asset-legacy#uses-cases-eligible-for-exemption

https://shopify.dev/docs/apps/build/online-store/asset-legacy#uses-cases-eligible-for-exemption

I hope this is useful to you

1 Like