Hi,
I am writing a theme app extension which has some app blocks and I want to activate them on certain areas like above “Add to Cart” button in product template automatically. While I read that we can a provide a deep link to merchant to add the app block in theme editor to a section and save, I also see that apps automatically activate the app block without needing merchant to do anything. But I cant find any clear documentation or articles around it. Would somebody here know how that is done? Can you please share? Many thanks in advance.
I asked the .dev Assistant for this one and it suggests you can use the ThemeAppExtentionUpdate
mutation to enable the app block on specific pages or sections of the theme.
https://shopify.dev/docs/api/admin-graphql/2024-10/mutations/themeAppExtensionUpdate
You may try asking it as well for a code example to test.
That said, I believe deep-linking is probably ideal so that the merchant can enable it themselves and check within the Theme Editor first rather than have live traffic automatically affected.
Thanks but that link is not working and when I search for themeAppExtensionUpdate. I dont see any result in the search as well
I think there can be better ways to do this especially if there are multiple app blocks.
For e.g. while activating app-embed, show all blocks in preview mode with easy on off toggle and then customer can edit or move them around and save vs customer going to your app, click on a deep link, edit, save and come back to app and click on another deep link etc.
Clicking deep links and adding the theme app extension is a hassle for merchants and results in poor UI/UX
I’ve seen some apps activate the theme app extension by default which puzzles me I thought they might be using the Assets API but I’m not convinced since it’s a theme app extension being added, not just modifications to theme files
I’m very interested in hearing if there’s a solution for this
I am also interested in this. I did not know there was a way to automatically turn on the app embeds
I can imagine some are possibly activated via the Assets API.
Just modifying the config/settings_data.json
and adding to the "blocks"
something like this:
"blocks": {
"unique-app-handle": {
"type": "shopify://apps/unique-app-handle/blocks/app-embed/unique-id",
"disabled": false,
"settings": {
}
}
},
Replacing the “unique” bits with your own.
I am unsure if that would be enough to make it active but if so then that seems like it would be relatively easy to do…
Doing this may potentially enable App Embed… I understand app Embed cannot be activated automatically though and merchant needs to visit the app embed section to switch it on… but app blocks I have seen other apps activating automatically.