A space to discuss online store customization, theme development, and Liquid templating.
Hello, everyone!
Is it possible to get your own variables inside of liquid templates using apps? For instance if I create some kind of object in my app database, would it be possible to have this data available as a {{ placeholder variable }} in .liquid template files? Just like one would access {{ product.price_min }} or such?
Would be so grateful for an answer to this.
The more thorough explanation, if anyone has time to read it:
( My usecase is this: I would like to build an app for my client which lets users choose between various Pickup Spots. These Pickup Spots should be added in the Admin in my app, and then on the frontend in the template users of the app should be able to select their pickup spot that is close to their location.
First I thought about just keeping the data in the browser using local storage or whatever, but then I realized that I need to output the data they selected in the confirmation mail template -> "Hello, your order is ready for pickup at {{ pickup-spot.location }}", if you know what I mean?
Is this even possible with Shopify somehow? I would be so grateful for any help. Thank you so much. )
Solved! Go to the solution
This is an accepted solution.
Use metafields.
Code is either added to the rendered output either directly in template files, or as as custom-liquid blocks|sections, or even as app-blocks.
For frontend rendering use scripttags, sections rendering api, or app-proxies.
If you use metafields for frontend liquid templates the app , or the merchant , will still need to add that code to reference the variable.
https://shopify.dev/apps/metafields
I highly suggest you spend a week going over the dev docs for apps and themes to understand the integration methods, there's a lot of subchoices here
https://shopify.dev/apps/online-store/theme-app-extensions
https://shopify.dev/apps/online-store/other-integration-methods
'adding data to store|storefront''with app' and other word variations on that problem is the search phrase as there's a lot of subchoices depending on what your doing
Contact [email protected] for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
This is an accepted solution.
Use metafields.
Code is either added to the rendered output either directly in template files, or as as custom-liquid blocks|sections, or even as app-blocks.
For frontend rendering use scripttags, sections rendering api, or app-proxies.
If you use metafields for frontend liquid templates the app , or the merchant , will still need to add that code to reference the variable.
https://shopify.dev/apps/metafields
I highly suggest you spend a week going over the dev docs for apps and themes to understand the integration methods, there's a lot of subchoices here
https://shopify.dev/apps/online-store/theme-app-extensions
https://shopify.dev/apps/online-store/other-integration-methods
'adding data to store|storefront''with app' and other word variations on that problem is the search phrase as there's a lot of subchoices depending on what your doing
Contact [email protected] for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
Thank you so much Paul, I will look into this right away! 😃