Liquid, JavaScript, themes, sales channels
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!
User | RANK |
---|---|
25 | |
21 | |
8 | |
7 | |
6 |
Explore the 30-30-30 rule, a dynamic social media strategy for new businesses. Learn how t...
By Trevor Sep 20, 2023Discover how to leverage the often overlooked footer of your ecommerce site to gain custom...
By Skye Sep 15, 2023In this blog, we’ll be shining a light on Shopify Partners, Experts, and Affiliates. Who a...
By Imogen Sep 13, 2023