Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Hello, we are trying to make a shopify application for our currently live project. Our application generates an embed code (a simple js file) and we expect our users to add it to their sites. For this, I am currently using the script tag api. Do I need to migrate to app extension? In which cases should I use an application extension?
Yea, based on the documentation suggestions creating an extension appears to be the best solution to "cleanly"/safely inject tags based on 2.0 themes.
be sure to read up on the app-building documentation here: https://shopify.dev/docs/apps/tools/cli/structure
https://shopify.dev/docs/apps/online-store/theme-app-extensions
Inside the theme extensions block folder (within the application project) you will create something like this:
{% schema %}
{
"name": "Your Name",
"target": "body", // THIS IS IMPORTANT
"stylesheet": "file-name.css",
"javascript": "file-name.js",
"settings": []
}
{% endschema %}