Detecting enabled app embed block in vintage themes

@Virtooal , @hrstrand , @johnyjoe

Untested spitballs for app-blocks If I can get time I’ll try it with the sample review app to vet this and if works maybe push it as a branch /shrug.

Not clear if bubbling , or if block restrictions like not accessing section liquid objects , gets in the way of any of the below.

For one-way detection , ?regardless of deep linking? , try using request.design_mode and ping a unique server url with an enabled flag.

Of course if they nuke a section nothings getting sent out when that happens; unless some other liquid elsewhere in the theme is doing something hinky to detect a lack of something.

So maybe instead through the javascript events shopify:section:load & shopify:section:unload

If this is a path for the lifecycle probably watch out for ajax concurrency if a merchants doing stuff quickly which could cause a disabled to arrive before an enabled, giving you a flag of enabled while it’s actually disabled.

#1 Merchant enables app > #2 merchant disables app = truth is disabled in theme.

#1 Server gets disable app request > #2 Server gets enable app request = false is enabled on server.

https://shopify.dev/themes/tools/online-editor#detecting-the-theme-editor

https://shopify.dev/themes/architecture/sections/integrate-sections-with-the-theme-editor

Remember to avoid heavily changing theme appearance through usage of design mode detection to prevent merchant UX confusion with what they think shows to customers.

1 Like