RMoreno
1
Hi Shopify Community !
I’d super appreciate getting your insight on a particular problem that’s been torturing me for an hour :
I have a custom schema here in my section :
{
"type": "text",
"id": "banner-1-text",
"label": "Texte",
"default": "Texte"
},
==
Now I want to pass the text written in there to a snippet in that same section, so i did this :
{% assign banner-1-text = section.settings.banner-1-text %}
{% render 'collections-banner', banner-text:banner-1-text %}
And in the snippet, I’m outputting a bunch of stuff, but for the sake of this question let’s shorten it to :
<div>
<p> {{banner-text}}</p>
</div>
This, according to what i read on forums, should do the job, but for some reason nothing is passed to the snippet and the
tag returns an empty tag
I really have no idea what I’m missing, so any help would be of great use and appreciated !
Thanks !
Not sure if it’s the issue, but it’s convention to name your liquid variables and schema ID’s using underscores instead of hyphens.
Try calling it banner_1_text instead of banner-1-text and see if it works.
Hi @RMoreno ,
Please change the code: banner-text => banner_text
{% render 'collections-banner', banner-text:banner-1-text %}
=>
{% render 'collections-banner', banner_text:banner-1-text %}
and
{{banner-text}}
=>
{{banner_text}}
it will work fine.
RMoreno
4
Thanks for the best practice !
I’ve tried though and it’s still not showing anything ..
I’m using the theme Expression (not that I think it has any impact but just in case).
Assuming you renamed your schema with underscore as well, it’s now a new variable and you’ll need to go into the theme editor and set it.
RMoreno
6
Hehe
Edit : I had forgotten to rename the assignment tag as well.
Works like a charm now ! Thanks a lot !