Can external data be used in liquid tags?

Can external data be used in liquid tags?

artooras
Shopify Partner
24 0 13

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
7722 678 1627

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 

 

Contact paull.newton+shopifyforum@gmail.com 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


artooras
Shopify Partner
24 0 13

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?