How to enable app block in theme automatically via api

enessahin
Shopify Partner
4 0 0

Hi everyone

 

I m developing a shopify app and theme-app-extension for app block. When a merchant installed my app, i need to add app block to default product page under variant_picker automatically. Merchant can click to a button which says "Enable Extension" and then it would automatically add this block in theme via API. I need a way to handle that but i can't find any useful explanation. 

 

I m appreciate for any suggestion. 

Replies 2 (2)
Alex_Kli
Shopify Partner
1 0 0

I think you can try to change the following asset via api

GET https://[store].myshopify.com/admin/api/2022-07/themes/[theme_id]/assets.json?asset[key]=config/settings_data.json
Content-type: application/json
X-Shopify-Access-Token: [access_token]

 

SmartDataSoft
Shopify Partner
3 0 2

Shopify new assets api prevent to put file in theme . is this code work for user.