Migrating Legacy Shopify App Extensions to Shopify CLI Management
.png)
If you’ve been building on the Shopify ecosystem for a while, you likely maintain legacy app extensions that predate modern CLI workflows. Moving those extensions under Shopify CLI management unlocks unified version control, streamlined local previews, and single-command deployments—without forcing you to rebuild your existing app backend.
Here is the exact, step-by-step workflow to map a legacy
extension to a modern CLI-managed project while preserving
its live production link or getting a warning like below
when trying to deploy the app by pasting values inside the
shopify.app.toml and running the
shopify app deploy command.
Before You Start: Two Critical Rules
Because you are mapping local files directly to an active app configuration in the Shopify Partner Dashboard, precision matters:
- Zero typos. A single mismatch in your extension handle, file structure, or environment variable key will prevent the CLI from recognizing the existing extension—or worse, cause it to generate a duplicate.
- Use production values only. Ensure every handle, title, and UUID you copy is pulled from your active production version in the Partner Dashboard, not a staging or development build.
Step 1: Initialize a Clean Workspace
Create a new, empty directory for your migrated project. Open your terminal (PowerShell, Command Prompt, or Bash) inside that folder and initialize the CLI:
shopify app init
Step 2: Choose an Extension-Only Architecture
When prompted by the CLI to select a project template, choose the option that leaves your existing backend untouched:
- "Build an extension-only app"
Step 3: Link to Your Existing App
Next, the CLI will ask whether to register a new app or attach to an existing one. Select:
- "No, connect it to an existing app"
Step 4: Select Your Target App
Search the interactive prompt list and select the existing Shopify app in your Partner Dashboard that owns the legacy extension you are migrating.
Step 5: Port Your Legacy Extension Files
Once the CLI scaffolds the project, navigate to the
extensions directory. Create a subfolder
named after your extension and copy over all of your
legacy source files (e.g., assets,
blocks, locales,
snippets).
Your directory structure should match this path:
new_app/extensions/your_old_extension_name/[paste your files here]
Step 6: Configure shopify.extension.toml
Inside
new_app/extensions/your_old_extension_name/,
create a new shopify.extension.toml file.
Populate it with the exact metadata from your active app
version in the Partner Dashboard and .env
file from your older extension code, or search for the
values below inside the legacy code:
name = "VALUE_OF_EXTENSION_TITLE"
type = "TYPE_OF_EXTENSION"
handle = "VALUE_OF_HANDLE_FROM_ACTIVE_VERSION_OF_APP_FROM_DASHBOARD"
(Note: For a standard Theme App Extension,
type should be set to
"theme").
Step 7: Migrate Your .env File
Copy the .env file from your legacy
extension directory into the root of your new
CLI workspace:
new_app/.env
Step 8: Map the Production Extension UUID
Open new_app/.env and define the
environment variable that binds your local extension
handle to its production UUID in Shopify's backend:
SHOPIFY_YOUR_HANDLE_NAME_ID="VALUE_OF_EXTENSION_UUID"
Sanity Check:
Make sure YOUR_HANDLE_NAME matches the
handle defined in
shopify.extension.toml
(converted to UPPER_SNAKE_CASE with
hyphens replaced by underscores) and that the value
matches your live extension UUID.
Verify Your Migration
Once your files and environment variables are in place,
run shopify app dev to confirm the CLI
detects your existing extension without prompting you
to create a new one. When you're ready to ship updates,
shopify app deploy will push your changes
directly to your live app version.
Troubleshooting Common CLI Deployment Errors
Even when you follow every step carefully, minor
formatting discrepancies can trigger errors during
shopify app deployment. Here is how to
resolve the most common issues:
-
CLI prompts to create a new extension instead
of updating the existing one.
This happens when the CLI cannot match your local
configuration to the extension registered in your
Partner Dashboard. Check that your
.envfile is placed in the rootnew_app/directory (not inside theextensions/subfolder) and verify that theSHOPIFY_<HANDLE>_IDkey usesUPPER_SNAKE_CASEwith all hyphens converted to underscores. -
Extension UUID not found or unauthorized error.
Your local CLI session may be authenticated to the
wrong Partner organization, or the UUID in your
.envfile points to a deleted or staging version. Runshopify auth logoutfollowed byshopify app deployto re-authenticate with the account that owns the production app, and re-copy the UUID directly from the active app version in the Partner Dashboard. -
Handle mismatch or validation failure in
shopify.extension.toml. Shopify enforces strict matching between thehandlein your TOML file and the live extension slug. Ensure there are no trailing spaces, capitalization differences, or accidental quotes inside the string values, and confirm thattypematches the exact extension classification (e.g.,theme,ui_extension, orfunction). -
Bundling or missing asset errors on deploy.
Legacy extensions sometimes rely on relative paths
or deprecated Liquid tags that fail modern CLI
validation checks. Inspect the terminal stack trace
to identify the offending file inside
extensions/your_old_extension_name/, verify that all referenced assets sit within theassets/folder, and ensure yourblocks/files adhere to current schema size limits.
Need a Hand With Your Migration?
Migrating production extensions with active merchant installs leaves very little room for error. If you run into CLI mapping issues, handle mismatches, or complex multi-extension setups, contact us if you need support around this task —MLVeda is happy to help you get your workflow running smoothly.