Ratan Kumar
Ratan Kumar

Reputation: 1650

shopify script tag not functional on store

following the proper auth from the standard api calls .

after making the complete authentication

shortname= shopify.Shop.site
shortname=shortname[8:-20]
url='http://mysite.com/widget/v1/'+str(shortname)+'/script.js'
shopify.ScriptTag(dict(event='onload', src=url)).save()

this give the response as

ipdb> shopify.ScriptTag(dict(event='onload', src=url)).save()
True

which i suppose now creates the script tag in store site

but when opening the store online i am not able to find my script url in the store's source code .

any idea why things are not woking that way ??

Upvotes: 0

Views: 564

Answers (1)

Jason N
Jason N

Reputation: 461

The script is injected into the code when the onload event is fired, it's not directly inserted into the code before. If you're looking at the source of your store you should see your scripts url inserted into the asyncLoad function. This function just loads all script tag js files when onload is fired. If it's still not there, you should try getting the list of script tags through the API and make sure yours is in that list.

Upvotes: 1

Related Questions