What happens to themes when you install an app?

Topic summary

A user seeks clarification on how third-party Shopify apps interact with themes during installation.

Main Questions:

  • Does app installation inject code only into the currently published (live) theme, or does it affect unpublished/previous theme versions as well?
  • Should users duplicate their theme before installing apps to maintain a clean backup?
  • Why can previous themes still be previewed with apps visible if code wasn’t injected into those unpublished versions?
  • Is the code injection limited to the live theme to avoid leftover code from uninstalled apps affecting the website?

Current Status:
The discussion remains open with no responses yet. The user acknowledges resources likely exist but is struggling to locate clear documentation on this theme-app relationship.

Summarized with AI on November 14. AI used: claude-sonnet-4-5-20250929.

I’m trying to understand how installed 3rd party apps affect the different themes.

Is it so that when I install an app, code is normally injected into (only) the published theme? And not into the previous versions (those that are not live)?

If so, does this mean that it may be a good practice when one installs an app, to first duplicate the theme, so one may go back to the backup if one decides not to use the app (uninstall it)? Because code is only injected to the live theme? (To avoid code lying around from an uninstalled app, perhaps affecting the website).

But if so, why can I preview previous themes, and the apps will be there, even if code isn’t injected into them?

I’m sure there are recourses on this, I just struggled finding them.

Thanks!

-Knut