How to update merchant theme.liquid via API

JHLEE
Tourist
6 0 1

Hello,

I am developing an Shopify Public App that inserts JavaScript code to merchant's storefront.  In order to accomplish this task, the app needs to update merchant's theme.liquid via API.  And I need StoreFront Access Token in order to access the theme.liquid.   Per Shopify document, I think I need to create Sales Channel in order to request StoreFront Access Token for the store.  Am I right on this?  Also, is there better way to accomplish code insertion to the store?   XO insert code(https://apps.shopify.com/insert-code-to-header-and-footer) is the perfect example, but my app just needs to insert the javascript code in the footer.  And the JavaScript will be copy and past in the textarea upon installation of the app by the user.

Thanks,

0 Likes
Jivan_Suhagiya
Shopify Partner
494 68 104

Hi,
Rather than inserting javascript into theme files, its better to use scripttag! 
you can learn more about it at https://shopify.dev/docs/admin-api/rest/reference/online-store/scripttag

If helpful then please Like and Accept Solution.
Email: suhagiyajivan1992@gmail.com
Skype: jivan.suhagiya
First kind of Checkout Reminder APP: https://apps.shopify.com/checkout-reminder
0 Likes