Ad

Shopify Script Tags Create Method Does Not Show Response In A Console

- 1 answer

I am attempting to make a Shopify app using shopify-node-app.I have done all initial setup for making an app.I have done with setting-up App-Proxy.I have started with the Script Tag which is necessary part on making an app.I am using shopify-api-node to create ScriptTag create method and the code is below.

const registerScriptTags = function(shopDomain, accessToken, scriptTag) {
const shopName=shopDomain.replace('.myshopify.com','');
const shopify = new ShopifyAPIClient({ shopName: shopName, accessToken: accessToken });

console.log('scriptTag= ', scriptTag);

shopify.scriptTag.create({
  event: 'onload',
  src: 'http://yourjavascript.com/1448951127/scripttag.js'
})
.then(response => console.log(response))
.catch(err => console.error(err));

console.log('scriptTag= ', scriptTag);
}

I do not see any response , error , scriptTag in an console.

I need to Check whether I am calling this function passing the params. I am adding scriptTag as 3rd param but also hard-coding it in function.

What I needs to do here ? 1) Do I needs to hit any specific url to see the response? 2) Can anyone able to explain last two statement above with my same code ?

Thanks.

Ad

Answer

The above code was perfect.I have to stop and restart server app, unless you use nodemon which is not currently. Also I uninstall and reinstall app in demo store. Since afterAuth is called once after installation. So any code changes in afterAuth, registerWebhook, registerScriptTag will need uninstall and install.

Ad
source: stackoverflow.com
Ad