How to enable app block in theme automatically via api

How to enable app block in theme automatically via api

enessahin
Shopify Partner
4 0 2

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]

 

Arif_Shopidevs
Shopify Partner
488 40 91

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

Syncora: Backup & Restore [Free] - Automated real-time store backup with one-click easy restore.
Slider Revolution - Create sliders, theme sections, banners, videos, pages, advanced animation, and social feeds.
Essential Grid Gallery - Create photo galleries, video galleries, portfolio galleries, product gallery, collection gallery, and more.
EasyDisplay: Product Showcase - Easily display collections, related products, discounts, recently viewed items, and best sellers.