Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi
Now that 'include' is legacy, what's the correct way to make variable accessible?
I've got a complicated snippet, which essentially created a handful of variables. It's used about 20 times in the theme, so I'd like to avoid having 20 copies of it.
Something like:
{% liquid if product.handle contains foo
assign var1 = 1
assign var2 = 2
...
I'd use it like this:
{% include 'snippet' %}
{{ var1 }}
That doesn't work with 'render', and I can't find a mention of a way to do it correctly.
Would anyone be able to point me in the right direction?
Many thanks!
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024