Created
November 20, 2019 23:33
-
-
Save iamkeir/be515ef1698f231878fad9fb4069b1d9 to your computer and use it in GitHub Desktop.
Shopify: Dynamic section hack
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
{% comment %}Workaround for dynamic sections outside of homepage{% endcomment %} | |
{% for block in section.blocks %} | |
{% if product.handle == block.settings.product %} | |
{% | |
include 'hero' | |
hero_title: block.settings.title | |
%} | |
{% endif %} | |
{% endfor %} | |
{% schema %} | |
{ | |
"name": "Product hero", | |
"settings": [ | |
{ "type": "paragraph", "content": "Edit the item that matches the current product." }, | |
{ "type": "paragraph", "content": "If no matching item exists, add a new section and choose the current product from the dropdown." } | |
], | |
"blocks": [ | |
{ | |
"type": "product_hero", | |
"name": "Product hero", | |
"settings": [ | |
{ | |
"id": "product", | |
"type": "product", | |
"label": "Product" | |
}, | |
{ | |
"type": "text", | |
"id": "title", | |
"label": "Hero title" | |
} | |
] | |
} | |
] | |
} | |
{% endschema %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment