Hi there,
I’m in the process of developing my first Shopify application and am having trouble finding a way to reflect the app’s configuration on the Shopify store dynamically. Is there any references that can assist me with this?
A random example:
-
Customer in Shopify dashboard selects they want the app to put a big red button on the home page
-
App extracts the data from the configuration
-
App places big red button on home page automatically
How do I dynamically inject this code into the theme’s liquid as described?
Thanks,
K
Hi Kane,
App extracts the data from the configuration
There are a few ways of doing this:
- via an app proxy to reach into your server to grab the configuration, typically in conjunction with a script tag loaded JS file
- using metafields and grabbing it via liquid
- writing a file to the themes assets so you can access it via settings in liquid
Each has pros and cons so I’d recommend searching around this forum a bit to read up on it.
How do I dynamically inject this code into the theme’s liquid as described?
Shopify’s recommendation is to use a script tags. The problem is they load after everything else, which is Ok on a site that has been optimized with small images and such but they can be slow for some sites, especially if there are a lot of apps installed.
HTH, Gavin.
1 Like