Set condition for schema block text if the collection is fill then overwrite the schema block text

hi everyone

this is schema

{% schema %}
{
“name”: “Third section”,
“settings”: [
{
“id” : “myfav”,
“type” : “text”,
“label” : “top left heading”
},
{
“id” : “myshop”,
“type” : “text”,
“label” : “top right heading”
}
],
“blocks”: [
{
“type”: “image_picker”,
“name” : “Image Slide”,
“settings” :[

{
“id” : “textone”,
“type” : “text”,
“label” : “Text”
},
{
“id” : “imageone”,
“type” : “image_picker”,
“label” : “Image right”
},
{
“id” : “collection”,
“type” : “collection”,
“label” : “collection”
}

]
}
],
“presets”: [
{
“name”: “Top Banner”,
“category”: “Custom Sections”
}
]
}
{% endschema %}

this is condition

{% if block.settings.textone==blank %} {% elsif collections[block.settings.collection].title %}{{collections[block.settings.collection].title}}{{ collection.title }}{% endif %}

you can see in the picture over the water text can change to Ahmad58

anyone help me to condition

Hello,

Yes your schema is nicely formatted, now you need to put it into assets (in theme).

Then call it like {{ assetname.xxx }}, it would be a good asset start

Have fun with Shopify,

1 Like

Hi @Shuja5developer ,

Please change code:


  {% if block.settings.textone != blank %} 
    {{ block.settings.textone }}
  {% elsif collections[block.settings.collection].title %}
  	{{collections[block.settings.collection].title}}{{ collection.title }}
  {% endif %}

Hope it helps!

1 Like