Hi everyone,
I’m working on a public app feature and want to check how others (and Shopify staff) handle this before building it.
Setup
- The app adds a storefront widget through a theme app extension (app embed + optional app block).
- In the app admin, merchants can enter their own Custom CSS to style the widget.
- The app embed injects that CSS as a
<style>element, set as text (so no script can run from it).
The question
Because it’s a normal <style> element, the merchant’s CSS isn’t limited to our widget. It can also restyle or hide theme elements, e.g. the product title or the add-to-cart button.
- Is it acceptable for an App Store / Built for Shopify app to inject merchant-authored CSS that can affect theme elements outside the app’s own block/embed? Or should app-injected CSS be limited to the app’s own elements?
- Has anyone had App Review flag this? If so, what did they ask you to change?
- Would you scope it, e.g. with CSS
@scope (.widget-root)or by prefixing every selector with a root class? How do you handle merchants who already style outside the widget?
What we already plan to do
We’ll follow the same rules as Shopify’s own theme editor Custom CSS:
- block
@import,@charsetand@namespace - only allow URLs from
https://cdn.shopify.com(plus inlinedata:image/)
so the CSS can’t load anything from outside servers.
Partner Support told me this isn’t covered in the published App Store requirements, so they couldn’t confirm either way. The only related rule I found is 5.1.1 (modify themes only through theme app extensions), which this approach follows.
Also curious whether the upcoming “tightening the boundaries for storefront app code” from the Securing your app, together post is expected to cover app-injected CSS.
Thanks!