Created
September 5, 2018 09:18
-
-
Save marioloncarek/3df2b9d227ce1a6a8bca07b0ea8aa0d8 to your computer and use it in GitHub Desktop.
Shopify collection blocks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <section class="collection-blocks"> | |
| {% for block in section.blocks %} | |
| {%- assign collection = collections[block.settings.collection] -%} | |
| {% if block.settings.collection-title != blank %} | |
| <h2 class="collection-blocks__collection-title">{{ block.settings.collection-title | escape }}</h2> | |
| {% else %} | |
| <h2>{{ collection.title }}</h2> | |
| {% endif %} | |
| {% for product in collection.products limit: 6 %} | |
| <a href="{{ product.url | within: collection }}" class="single-product"> | |
| {% if product.featured_image != blank %} | |
| <div class="single-product__image"> | |
| {% include 'responsive-image' with | |
| image: product.featured_image, | |
| max_width: 480, | |
| max_height: 480 %} | |
| </div> | |
| {% endif %} | |
| <p>{{ product.title | escape }}</p> | |
| </a> | |
| {% endfor %} | |
| {% endfor %} | |
| </section> | |
| {% schema %} | |
| { | |
| "name":"Collection Blocks", | |
| "settings":[ | |
| ], | |
| "blocks": [ | |
| { | |
| "type": "select", | |
| "name": "Add Collection", | |
| "settings": [ | |
| { | |
| "type":"text", | |
| "id":"collection-title", | |
| "label":"Collection title" | |
| }, | |
| { | |
| "id":"collection", | |
| "type":"collection", | |
| "label":"Chose Collection" | |
| } | |
| ] | |
| } | |
| ], | |
| "presets":[ | |
| { | |
| "name":"Collection Blocks", | |
| "category":"Collection", | |
| "blocks": [ | |
| { | |
| "type": "select" | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| {% endschema %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% section 'collections-blocks' %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment