October 17, 2021

Displaying a default image placeholder if the user hasn’t uploaded image

Shopify image placeholder if the user hasn’t unloaded anything via the theme settings. The placeholder default images are being used to demonstrate to the user what the image grid will look like before uploaded their own images.

{% if section.settings.image != blank %}
  <img src="{{ section.settings.image | img_url }}" alt="" />
{% else %} 
  {{ 'lifestyle-2' | placeholder_svg_tag: 'placeholder-svg' }}
{% endif %}

{% schema %}
  {
    "name": "Image Picker",
    "settings": [
      {
        "type":"image_picker",
        "id":"image",
        "label":"Image" 
      }
  
],
"presets":[
    {
    "name":"Image Picker"
  }
]

  }
{% endschema %}

Leave a Reply

Your email address will not be published. Required fields are marked *