Liquid, JavaScript, themes, sales channels
Hi all, I always see block types in schema, but I'm not sure where I can define them? Where do make the block definitions? Or does Shopify have block type presets I can look at? Thank you!
Solved! Go to the solution
This is an accepted solution.
Block types are completely custom, so there is no documentation on what block types there are. They are whatever you want them to be, and then you check for that when you want to know the type of block it is.
"blocks": [
{
"type": "page-banner",
"name": "Page Banner",
"settings": [{...}]
},
{
"type": "custom-module-x",
"name": "Custom Module (version X)",
"settings": [{...}]
},
{
"type": "abc-block",
"name": "ABC Block Name",
"settings": [{...}]
}
]
{% liquid for block in section.blocks
case block.type
when 'custom-module-x'
include 'snippet-custom-module-x'
when 'page-banner'
include 'snippet-page-banner'
when 'abc-block'
include 'snippet-abc-block'
endcase
endfor %}
Hello There,
check this one article how to define schema and block types.
https://www.shopify.in/partners/blog/how-to-create-your-first-shopify-theme-section
Hi Pallavi, thanks for your reply.
I know how blocks generally work but I don't know specifically where to find and what "type" in the block parent does. I can't seem to change them and they don't show up anywhere?
Some examples:
So I know what the blocks inside do, but what does the "type" in the parent means?
And where are those defined? I saw that "collection" type in a theme, but I can't find it in any documentation?
Thanks!
Check this one article
https://github.com/Shopify/starter-theme/blob/master/src/sections/collection-list.liquid
This is an accepted solution.
Block types are completely custom, so there is no documentation on what block types there are. They are whatever you want them to be, and then you check for that when you want to know the type of block it is.
"blocks": [
{
"type": "page-banner",
"name": "Page Banner",
"settings": [{...}]
},
{
"type": "custom-module-x",
"name": "Custom Module (version X)",
"settings": [{...}]
},
{
"type": "abc-block",
"name": "ABC Block Name",
"settings": [{...}]
}
]
{% liquid for block in section.blocks
case block.type
when 'custom-module-x'
include 'snippet-custom-module-x'
when 'page-banner'
include 'snippet-page-banner'
when 'abc-block'
include 'snippet-abc-block'
endcase
endfor %}
Thank you so much! I get it now!
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024