After experimenting, I found that Shopify's strict Content Security Policy (CSP) blocks inline JavaScript in certain contexts. The best way to add JavaScript functionality in a Shopify App Embed Block is to:
-
Move JavaScript code to a separate file in the
assets
directory of your theme. - Reference the JavaScript file…