Skip to content

Instantly share code, notes, and snippets.

@deepp2887
Created June 1, 2017 06:21
Show Gist options
  • Save deepp2887/bbca9d681a070520fc605ddaf5fb67c2 to your computer and use it in GitHub Desktop.
Save deepp2887/bbca9d681a070520fc605ddaf5fb67c2 to your computer and use it in GitHub Desktop.
Making dynamic block section in admin for shopify.
<div class="pdp-section pdp-productInfo">
<div class="wrapper pdp-productInfo__container">
{% for block in section.blocks %}
<div class="pdp-productInfo__item" {{ block.shopify_attributes }}>
<div class="pdp-productInfo__image">
<img src="{{ block.settings.image | img_url: '240x' }}">
</div>
<div class="pdp-productInfo__content">
<h4 class="pdp-col__heading">{{ block.settings.heading }}</h4>
<p class="pdp-col__text">{{ block.settings.content }}</p>
</div>
</div>
{% endfor %}
</div>
</div>
{% schema %}
{
"blocks": [
{
"type": "text",
"name": "Product Info",
"settings": [
{
"type": "image_picker",
"id": "image",
"label": "Image"
},
{
"id": "heading",
"type": "text",
"label": "Heading"
},
{
"id": "content",
"type": "text",
"label": "Text"
}
]
}
]
}
{% endschema %}
{% stylesheet %}
{% endstylesheet %}
{% javascript %}
{% endjavascript %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment