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.

Restricting Theme Blocks

Restricting Theme Blocks

Cavera
Shopify Partner
24 0 10

I've been playing around with and loving the new Theme Blocks feature (launch this new feature for production ASAP please). Being able to nest and reuse blocks throughout the theme is a real game changer. I have run into one thing that I have either not been able to figure out or have found functionality lacking so wanted to post for feedback.

 

Some blocks, you may want to restrict where/when you are able use them. I hoped that I'd be able to use something similar to what you can do with sections and use an "enabled_on" for templates and global areas but doesn't appear to work.

 

Alternatively, I've tried creating template specific sections with section blocks in addition to theme blocks but it doesn't appear that you can't mix the two at this time so that won't work either. I have put checks into my blocks so if they are used in ways otherwise intended, they are disabled however it would be nice to not even show them in the theme editor when not compatible (like I can do with sections).

 

If I'm right and this just isn't possible at this time, I would request the feature be added that allows restricting, similar to how you can with sections. In addition, since blocks can now be nested within blocks, it would also be awesome if you could restrict which blocks can be children of specific blocks.

If I'm wrong and this is already possible, please tell me how or point me towards some documentation.

 

Thanks

Reply 1 (1)

Liam
Community Manager
3108 344 904

Hi Cavera! 

 

Great to hear you've been testing out the new global theme blocks feature. A few devs have also noted that having limitations on where blocks appear would be beneficial, and our product team are reviewing this feedback, so I'll pass on your ideas to them too. 

 

Thanks!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog