'Include' tag depreciation questions

timd
Shopify Expert
64 1 13

Over the past year I've seen 'render' pop-up in liquid but haven't taken any notice of but I've than 'include' is now depreciated so I have a couple of questions.

How long will 'include' work for before I begins to break websites?

And I have many multi-regional clients with stores for USA, EU, Australia etc so I often have a 'if-store.liquid' snippet which I use to define global variables eg.

 

 

{%- if shop.name contains 'United States' -%}
	{%- assign store_location = 'US' -%}
	{%- assign klaviyo_list = 'X' -%}
{%- elsif shop.name contains 'Australia' -%}
	{%- assign store_location = 'AU' -%}
	{%- assign klaviyo_list = 'X' -%}
{%- else -%}
	{%- assign store_location = 'NZ' -%}
	{%- assign klaviyo_list = 'X' -%}
{%- endif -%} 
 
 

 

 

 

This is so I can drop it into various templates and sections with an include tag but render will obviously break this functionality, so I wonder if there is a better/alternative way I should be doing this in the future?

0 Likes
timd
Shopify Expert
64 1 13

This is kind-of a bump but I'm also surprised now one else seems so having any issues with exporting variables from render tags.

Another example I have is that I use a reusable 'size-conversion' snippet to convert sizes:

 

{%- assign var_title = item.variant.options[i] -%}
{%- include 'size-conversion' -%}
{{ var_title }}

 

 

And in the 'size-conversion' snipped I have a conversion logic eg:

 

{%- if store_location == "eu" -%}
{%- assign var_title = var_title | replace: '28','38' | replace: '30','40' | replace: '32','42' | replace: '34','44' | replace: '36','46' -%}
{%- endif -%}

 

 

When/if 'include' is removed there will be no way to achieve this so it would be great if there was a way to export or use a variable outside of a render tag.

Maybe this isn't an widely discussed issue yet because we can still use include but I'd like to find a solution to this and start transitioning to render before its too late.

0 Likes