FROM CACHE - en_header

Liquid tags with external data

artooras
Shopify Partner
21 0 7

Is there a way to use external data in liquid tags? For instance, if I wanted to do something like this

{% if product.type == MY_VARIABLE_HERE %}
  You are buying some awesome shoes!
{% endif %}

where MY_VIARIABLE_HERE would be data that I fetched from an external database?

Replies 2 (2)
PaulNewton
Shopify Partner
4219 304 902

XYproblem WHAT are you trying to accomplish? https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem/66378#66378 

 

There is no support feature like that in liquid ; shopify liquid does not fetch remote data.

If you need that data it either needs to exist in the backend already or you need an app/proxy-app, or need to just move the logic to the frontend.

https://shopify.dev/apps/online-store/app-proxies 

 

Finally Combinable Discounts - EARLY ACCESS ONLY - Use Free Shipping With Other Discounts

Answers powered by coffee Buy Paul a Coffee for more answers or donate to eff.org
Problem Solved? ✔Accept and Like solutions to help future merchants
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com
artooras
Shopify Partner
21 0 7

Hi @PaulNewton , thanks for your response. Let me clarify the X, i.e. what I want to achieve in the first place. I want to show (or not show) my app widget on a product page depending on a condition, but in order to evaluate the condition for each product, I need to check the value against values that are unique to each merchant and are stored in an external DB. This is why I need the condition validation to be able to handle dynamic content.

What are the ways to achieve that?