Shopify Account Switcher
Work across several Shopify stores, under several different Shopify logins,
without re-authenticating and without ever wondering which store a terminal
is pointed at.
Scope a window to one store and one account. Every terminal you open in
it targets that store as that account — shopify theme pull, theme dev,
theme push, all with no extra flags.
Two windows can be scoped to two different stores at the same time, under
two different logins. Nothing machine-wide changes.
What a "store" means here
One entry in your config pairs a Shopify store with the login you use
for it. If you reach the same store under two accounts — an agency login
and your own, say — that's two entries, and you switch between them.
Requirements
Shopify CLI 3.50 or newer, on
your PATH. This extension never handles your credentials; the CLI owns your
sessions and this only says which one to use.
Getting started
- Click Shopify: set up in the status bar. It writes a starter config
and opens it.
- Fill in your store and the login you use for it, and save.
- Run Shopify: Sign In to an Account from the command palette
(
Ctrl+Shift+P). A browser opens; this happens once per account, ever.
- Click the status bar and pick your store.
Open a new terminal and run shopify theme list — no flags — and it will
already be talking to the right store.
Config
Lives at ~/.shopify/shopify-projects.json. The extension ships a schema,
so you get completion and inline validation while editing it.
{
"version": 2,
"accounts": {
"agency": { "email": "you@agency.com", "label": "Agency (shared)" },
"me": { "email": "you@example.com" }
},
"projects": {
"acme": {
"store": "acme-store.myshopify.com",
"account": "agency",
"path": "C:/Shopify/acme",
"themeId": null,
"themeName": null
}
}
}
| Field |
|
store |
The myshopify.com domain. Pasting the full admin URL is fine. |
account |
Which login to use. Must be a key from accounts. |
path |
Optional. Opening this folder scopes the window automatically. |
themeId |
Optional. Pins a theme so pull and push stop asking. |
themeName |
Optional. A readable name for that theme, shown in the tooltip. |
The alias in accounts is what Shopify CLI calls an auth alias — the name
you give a stored login.
How scoping works
Picking a store sets three environment variables on the window, which is why
terminals opened afterwards just work:
| Variable |
|
SHOPIFY_FLAG_AUTH_ALIAS |
the account |
SHOPIFY_FLAG_STORE |
the store |
SHOPIFY_FLAG_THEME_ID |
the pinned theme, if set |
VS Code marks terminals whose environment an extension has changed. That
indicator is expected — it's how the scope reaches the terminal.
Terminals that were already open keep the scope they started with: a
running shell's environment can't be changed from outside. Switching offers
to open a fresh terminal instead.
Commands
All under Shopify: in the command palette.
| Command |
|
| Switch Store |
Pick a store for this window |
| Clear Store for This Window |
Remove the scope |
| Theme Pull / Push / Dev |
Run the CLI with the right flags already filled in |
| Sign In to an Account |
Register a login with the CLI, or add a new one |
| Open Config File |
Edit your store list |
| Check Sign-In |
Confirm the account still has a saved sign-in |
Theme Push always confirms first, naming the store, account and theme.
It's the one command here that can destroy work.
Status bar
Shows the account and store for this window. Switching in one window
never moves another.
Hover it for the full picture of what you're working as: Shopify account,
store and theme, plus the git repo, branch, and the identity your commits
will carry — because pushing to the wrong GitHub account is the same kind of
mistake this extension exists to prevent.
If commands suddenly fail with "No authenticated account found"
shopify auth logout signs you out of every account at once and deletes
every saved alias with it. There is no per-account logout. Afterwards a plain
shopify auth login signs you back in but recreates no alias, so scoped
commands keep failing with:
No authenticated account found for alias <name>.
Run `shopify auth login` first.
Following that advice does not fix it. Only --alias recreates the name:
shopify auth login --alias <name>
The extension checks for this after you switch and offers a Sign in as
<name> button, so you should not have to diagnose it. Shopify: Check
Sign-In re-runs the check on demand. Turn the automatic check off with
shopifySwitcher.verifySignIn if you would rather it made no network calls.
Privacy
- No tokens, passwords or API keys are read, written or transmitted.
- Nothing is sent anywhere. There is no telemetry.
- The only file written is your config, plus a small file recording which
store was last picked.
- Switching starts no subprocesses.
shopify auth login runs in a terminal
you can see, because it opens a browser and may ask you things.
- The sign-in check runs one read-only
shopify theme list per account per
window, to catch a deleted alias before it wastes your time. Disable it
with shopifySwitcher.verifySignIn.
Optional: the PowerShell companion
The same repository
has a PowerShell module giving you sw, spull, spush and sdev in any
terminal, sharing this config. It is not included here and is not needed.
If you do install it, switching in a terminal updates that window's status
bar, and only that window's.
Licence
MIT.