Solved

app install on a store - how to add an app block to an existing theme template ?

den232
Shopify Partner
187 8 52

i'm developing an app.

 

When the app is installed on a store, it should change an online store template by adding an app block (or section).

 

For example, add an app block or add a collapsible row to the template.

 

How can I accomplish this task?

 

Thanks! jb

Accepted Solution (1)

kjchabra
Shopify Partner
22 1 4

This is an accepted solution.

@den232 your app needs to provide the admin user with a deep link, which once user clicks or navigates to, it adds the app block to the theme.

View solution in original post

Replies 3 (3)

kjchabra
Shopify Partner
22 1 4

This is an accepted solution.

@den232 your app needs to provide the admin user with a deep link, which once user clicks or navigates to, it adds the app block to the theme.

den232
Shopify Partner
187 8 52

Thanks so much, @kjchabra .    Next: Is it possible for a deep link to duplicate a template or add a new template?

 

Cheers jb

kjchabra
Shopify Partner
22 1 4

@den232 apologies for the late reply.

 

Yes you can duplicate a template via the Admin REST API using the Asset resource. You can call the  PUT method if you know which template to duplicate.

 

Just be careful that if you are planning to build an app for the Shopify store you do need to request access from Shopify.

 

Starting with Admin API 2023-04, Asset resource PUT or DEL requests are restricted using the write_themes access scope.
If an app that's distributed in the Shopify App Store needs to use Asset resource 
PUT or DEL requests, then it needs to be
granted an exemption by Shopify to use the 
write_themes access scope.