What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Dawn theme questions regarding section availability

Dawn theme questions regarding section availability

iamben
Shopify Partner
11 0 5

Hey guys, cross posted this with the Design board. Happy for one to be closed, what's the best board for Online Store 2.0 questions? - 

Been playing around with Dawn this evening. It's quite exciting. However, I can't figure something out, and can't figure out where in the new docs this is covered (or if it is?).

Firstly, what determines sections in the new .json theme file that can't be removed in the customiser? Like on a product page, we have:

iamben_0-1625311843301.png

 

Product information and Product recommendations, neither of which can be deleted. But any other section I add can be deleted. How do I create a section on a product template (for instance), that can't be deleted by someone making changes in the customiser?

Secondly, when I look at the sections available to me on other pages (say, the Homepage), I can't see the Product recommendations section as being available. I know this makes sense, but why isn't it available? I sort of figured it would be to do with the templates part in the schema (as here: https://shopify.dev/themes/architecture/sections/section-schema#templates) saying the Product recommendations could only be used in the product template - except that's not in the schema in that section! What determines that collage.liquid will be available everywhere, and pickup-availability.liquid isn't? Am I missing something?

Am sure I'll have more questions, but looking good so far.

Thanks! 

Replies 3 (3)

Tek
New Member
4 0 0

Hi,

You can restrict a section to certain templates by specifying those templates through the templates attribute. This attribute accepts a list of strings that represent the page type.

More info here:

https://shopify.dev/themes/architecture/sections/section-schema#templates 

 

Thanks

iamben
Shopify Partner
11 0 5

Hey, thanks @Tek - as noted I'd already read that in the docs.

But if you look at product-recommendations.liquid, where you'd expect to see:

"templates": ["article", "index", "page", "product"]

It doesn't exist. And yet product recommendations are not available as a section choice in the menu on the homepage, for instance. Hence my question. Are there some templates / sections that work on a 'reserved words' system or something?

Tek
New Member
4 0 0

product-recommendations is not a dynamic section that's why it is not available in theme editor.

You can add presets to the section file. Presets can be used to define how the section appears in the theme editor.