I'm building a Shopify embedded application (Node.js and Koa) that needs to inject a code snippet into the product listing page of the integrated e-commerce store. The idea is to present a custom icon against each product.
I'm using the Shopify ScriptTag API to set a local script that is called upon when the page loads.
The issue is there is quite a significant delay using this method. When the shopify product page loads, the custom icon appears approx a second after.
For simplicity I've attached a a test script that is loaded through the ScriptTag API below, which executes on page load:
Shopify Script Tag is injected dynamically and is asynchronous. I know this topic was discussed before somewhere, and there is a chance they will allow for synchronous loading somewhere in the future, but not currently. I had same issue by the way, I wanted to use script tag for smart way of validating if app is installed, but with dynamic injection it's not as simple as I wanted