Enable App Embed on installation of app

Enable App Embed on installation of app

kontinuity
Visitor
1 0 0

Hi,

We use an App Embed with Online Store 2.0. We are trying to figure out how to get an app embed which is required for app to work, to be enabled automatically in the theme on install.

Thanks,

Kontinuity

Replies 6 (6)

csam
Shopify Staff (Retired)
267 40 51

Hi @kontinuity 

The app embed blocks are deactivated by default, but after installation you can have the app prompt merchants with a 'deep link' which will automatically activate them. You can read more about how to do this here: https://shopify.dev/apps/online-store/theme-app-extensions/extensions-framework#simplified-installat... Hope this is helpful!

To learn more visit the Shopify Help Center or the Community Blog.

theapemachine
Shopify Partner
16 1 3

It is possible, I have just made this work using a pretty weird, but logical technique. Not too sure if I should openly say how its done though, as I would hate the method to be disabled.

Samkit
Shopify Partner
3 0 0

Please do tell, facing a similar issue

theapemachine
Shopify Partner
16 1 3

By using the Asset resource from the Admin API.

Enable your app manually, click save, then go and Edit Code from the theme editor and look for config/settings_data.json.

You will find a block related to your app.

 

Obviously the step above is just to learn what the whole deep link method and manually switching the thing on, which is the "normal" process is, really does, and you do not need to do this after you have the json block you need for the next step, which is really how to automatically turn your app on when installed.

 

Now use the Asset API to GET the key=config/settings_data.json add in the same things you found when you looked at the code, but put "disabled" to false.

PUT that back into the API, and the App is turned on 😉

 

While I did run this in production and it does work, be very mindful that there may be other plugins or things mixed in as well, so you will have to make sure you do not overwrite anything when pushing in the additional block.

rivo-bernie
Shopify Partner
4 0 4

Sadly, the Asset Resource will be deprecated in a few months. This doesn't seem like a good approach at the moment.

Jesse33
Visitor
1 0 0

Hey! I just wanted to drop by and say that your blog post was great!  I found the content incredibly valuable and it's got me excited! Also, big props on the blog – it was an easy read! I'm pumped to try out these strategies in the future. Oh, and I stumbled upon another article on the same topic that you'll find interesting https://expertguru.ai/blogs/insights/leveraging-react-and-liquid-for-enhanced-app-embed-block-in-sho...