Note, this issue is specifically for Shopify's implementation of liquid on their website.
We should be able to do this:
{{ products["austin-leaf-map-poster"].url }}
But we (developers) don't have access to a products global.
Instead of having access to the global. I have to hack something together like this:
function.get_product.liquid
{% assign return = false %}
{% if pass_product_handle and collections["all"] %}
{% for product in collections["all"].products %}
{% if pass_product_handle == product.handle %}
{% assign return = product %}
{% endif %}
{% endfor %}
{% endif %}
usage.liquid
{% assign pass_product_handle = "austin-leaf-map-poster" %}
{% include "function.get_product" %}
{% assign product = return %}
{{ product.url }}
{% assign pass_product_handle = "boston-leaf-map-poster" %}
{% include "function.get_product" %}
{% assign product = return %}
{{ product.url }}
It can't be good for Shopify to have to interpret this loop every time I need product information, no?
We should be able to do this:
But we (developers) don't have access to a
productsglobal.Instead of having access to the global. I have to hack something together like this:
function.get_product.liquidusage.liquidIt can't be good for Shopify to have to interpret this loop every time I need product information, no?