Validating Theme App Extensions and how they work?

HunkyBill
Shopify Expert
4615 54 531

So we are told to update to Theme App Extensions moving forward. All themes will be working with this soon enough. OK. So they methodology explained is unclear. I reflect here on the code published by Shopify to ask some basic questions.

 

if (templateJSONFiles.length === sectionsWithAppBlock.length) {
  console.log('All desired templates have main sections that support app blocks!');
} else if (sectionsWithAppBlock.length) {
  console.log('Only some of the desired templates support app blocks.');
} else {
  console.log("None of the desired templates support app blocks");
}

 

My question start with, the three conditions here. First, all templates (product, index, and collection) have main sections that support App Blocks. Second, only some of the desired templates support App Blocks, and finally, none of the desired templates support App Blocks.

What are we to do with this information exactly? Say I want to add a Theme App Extension Block to my App, and I find the theme set to Live in the Store has a product.json file as a template. WOW. What can I do with that? I probe that file and I find it has a section main. Wow. What can I do with that? Suppose that template block further has a section with a block set to @app. Wow! What can I do with that?

It seems that through all that discovery, I am simply detecting things out of my control. If I wanted to insert some custom JS and HTML in a little block in a new V2.0 Theme, I still need to merchant to open their theme, and add a block for my App to insert said content right? And further, the App they installed in their store has the content, so they need not cruise the App Store looking for this block, it should just magically be appearing in their theme as a selection right?

So what if I find none of that stuff is true, like finding no product.json in the templates? Now I know this is an older Theme 1.0 and I have to get them to copy and paste snippet code into their theme templates. Wow. OK.. I can handle that. But if I find product.json as a template, now I know I can deal with an V2.0 theme? What is the exact criteria?

Thanks for any illumination on this. And Oh ya... the Shopify CLI App is currently not working, so I cannot even add Theme Extensions to an App, until that code gets fixed. Yay for progress!

 

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
Replies 0 (0)