Re: App embed blocks not working inside capture tags

App embed blocks not working inside capture tags

sinuhe
Shopify Partner
20 0 5

Hello, 

 

we are using app embed blocks for our apps. They generally work great. However, we have found some cases where the content of the theme.liquid file is wrapped by a "capture" liquid tag, and in those cases the app embed blocks are not injected in the storefront. Could you please take a look?


Thanks in advance.

Replies 4 (4)

Liam
Shopify Staff
2873 312 820

Hi Fransierra! Wrapping the content of the theme.liquid file in capture tags is not a pattern I've spotted before - which theme are you using? I'll also look into how best to work with app embed blocks in this context 🙂

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

sinuhe
Shopify Partner
20 0 5

Hi Liam, 

 

our apps don't wrap the theme.liquid content, but we have found some clients with this situation, with themes such as Envy 26.4.0 or LangShop Theme 2.14.5. However, we don't think this is a theme feature, rather it may be caused by some third app.

Anyway, we find the theme.liquid file with situations like:

 

 

{%- capture minified -%}
<!DOCTYPE html>
<html lang="en">
  <head>
  ...
  </head>
  <body>
  ...
  </body>
</html>
{%- endcapture minified -%}

 

 

where the "minified" variable is used in other templates, causing app embed blocks not being injected.

 

Could you try it? Thanks in advance and kind regards.

 

Liam
Shopify Staff
2873 312 820

I haven't seen this capture and minified as a theme dev pattern, but as you mention it's possible it's caused by an app. For example if you search the Shopify App Store for "minification" you'll find apps that affect theme Liquid files. Also since these are not themes on the theme store it's difficult for me to test easily. However I'll ask our product teams if they've encountered these use-case and how we can see how app embed blocks could operate in this context.

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

sinuhe
Shopify Partner
20 0 5

Hi Liam, 

 

in case it helps, we are observing some merchants whose "<head>" html tag is not closed in the theme.liquid file, or it is closed with a weird space like "</head >". In these cases, the app embed blocks are also not injected.