Hi, I need some help with the Theme App Block extension liquid schema. Is there any way to dynamically reference the APP_ID in the schema settings depending on the app? I couldn’t find a similar topic, so if this has already been asked, please send me the link.
Our company is developing an app, and we are using the Theme App Block. We have different development environments: local, development, staging, and production. We store information in a metaobject and want the user to be able to choose the correct metaobject for an app block from a set of available metaobjects. To achieve this, we use the metaobject block type, and it has a required property called metaobject_type, where the value is something like app--<appid>-basic-content. The issue I have is that the is not dynamic, and this becomes a problem because each environment uses its own app with a unique ID. However, the value needs to be hardcoded in the schema, which causes complications.
Is there a solution to make this value dynamic, depending on the app, so it can work like a variable tied to the specific app, as this block works in the context of the app? Would it be possible to use something like the Admin API $app: prefix? Perhaps I missed something in the documentation…
Creating a metaobject with a general type does not work because I need the metaobject and its definition to be deleted when the app is deleted. This is impossible if the user deletes the app because we lose API access and cannot remove it.
This same type of DX problem is across all types of extensions- checkout, customer accounts, Flow actions, etc.
I wrote a CLI tool to replace a variables file based on the current environment. That way you can change variables like API hosts for your different environments even though Shopify doesn’t support ENV vars for extensions or theme app blocks yet.
Thank you for your help, but we already have a similar script implemented. However, I’m interested in a native solution from Shopify, not a workaround.
Developing a theme extension which uses app owned metaobjects in settings, I’ve also encountered the same problem: the inability to use $app inside metaobject_type.
It would be really great to support the $app since it reduces the hardcoding and magic numbers: