Have your say in Community Polls: What was/is your greatest motivation to start your own business?
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.

Re: Verify 2.0 Theme Support for Shopify App

Solved

Verify 2.0 Theme Support for Shopify App

JayAdra
Shopify Partner
178 15 44

Hi there,

 

I'm implementing this process for my app:
https://shopify.dev/apps/online-store/verify-support#verify-support-for-app-blocks

 

I am trying to determine if the customer's theme supports app blocks. The code seems to be working fine, however I'm confused because the default 2.0 theme (Dawn) is outputting:

 

"All desired templates support sections everywhere!
Only some of the desired templates support app blocks."

 

This doesn't seem right? I would have assumed that the reference theme has full support for app blocks? I am targeting "product" and "cart" templates specifically.

 

Does this mean I can look at the first templates check only, and not the second one that checks for @app support? I seem to be able to add my app block to the cart page, even though it apparently doesn't support them.

 

Any clarification around this would be awesome, as I'm using it to determine whether or not to register ScriptTags.

 

Thanks,
Jay.

Accepted Solution (1)

JayAdra
Shopify Partner
178 15 44

This is an accepted solution.

I never found much info surrounding this, but ended up just trusting the first check (do the templates support sections), and skipping the second part.

 

So far haven't seen any issues with detection using this method. Still would love to hear if anyone has found otherwise or has other solutions.

View solution in original post

Replies 5 (5)

JayAdra
Shopify Partner
178 15 44

This is an accepted solution.

I never found much info surrounding this, but ended up just trusting the first check (do the templates support sections), and skipping the second part.

 

So far haven't seen any issues with detection using this method. Still would love to hear if anyone has found otherwise or has other solutions.

axis80
Shopify Partner
23 1 9

I'm not convinced that the example code at https://shopify.dev/apps/online-store/verify-support#verify-support-for-app-blocks is correct.  I have been using the second check (which looks for blocks of type '@app') and getting results that do not line up with what I'm seeing in the theme editor.  Like, it will report that some templates support app blocks when they don't actually work in the editor, and vice versa.

JayAdra
Shopify Partner
178 15 44

Yeah I just skipped the second check and things have worked well for me. I wish they would revise their example code for this.

Talktohenryj
Shopify Partner
140 0 27

I've been playing with this for the last hour. The code is so bad. Happy I found this thread to know I am not alone lol

 

Knert
Shopify Partner
2 0 3

I know I'm a little late to the party here but this whole process is appalling to me. This is bound to break in the future. Shopify should have created an API endpoint to do this for us. As soon as any one of those magic strings change (i.e. main- , sections) or the magic [1] index on ${main[1].type}, all of our installs will break.