The code editor from part 2 saves every keystroke straight to a theme. Shopify CLI turns that around: the theme lives on your computer, you edit it with any editor you like, and a local preview shows the result before anything reaches the store.

Install it

You need Node.js 22.12 or newer, Git 2.28.0 or newer and a package manager (npm, Yarn 1.x or pnpm). Then:

npm install -g @shopify/cli@latest
shopify version

On macOS you can use Homebrew instead: brew tap shopify/shopify, then brew install shopify-cli. There is no separate login step: the first command that needs your store opens a browser window to sign in.

Get a theme onto your computer

For an existing store, create an empty folder and pull the theme you want to work on:

shopify theme pull --store your-store

Without more flags it lists the store's themes and lets you pick one. --live pulls the published theme and --theme takes a theme ID or name. To start from scratch instead, shopify theme init my-theme clones Shopify's minimal Skeleton theme.

The live preview

shopify theme dev --store your-store

This uploads your local files to a private development theme and starts a preview at http://127.0.0.1:9292. It uses the store's real products and data, reloads CSS and sections instantly when you save, and prints a link to open the theme editor and a preview link you can send to a colleague.

Two details worth knowing: checkout customisations do not show in the local preview, and the development theme is deleted when you run shopify auth logout. If you change settings in the theme editor while working, --theme-editor-sync writes those changes back into your local files.

Check, share, push

  • shopify theme check lints the theme for Liquid errors and best practices. --auto-correct fixes what it can.
  • shopify theme share uploads the theme as a new unpublished theme with a random name and gives you a preview link. Ideal for showing a client work in progress.
  • shopify theme push --unpublished --theme "New product page" creates a named unpublished theme from your files.
  • shopify theme push --theme 123456789 updates an existing theme. Pushing to the live theme needs --allow-live in scripts, and --publish makes the pushed theme live.

The mistake that wipes a merchant's work

As part 1 explained, everything a merchant does in the theme editor is stored in templates/*.json and config/settings_data.json. Pull a theme on Monday, work until Friday, push, and every banner the merchant changed in between is replaced by your Monday copy.

Two habits prevent it. Pull right before you push, so your copy of those files is current. Or leave them out of the push entirely:

shopify theme push --theme 123456789 \
  --ignore "templates/*.json" --ignore "config/settings_data.json"

Quote patterns that contain wildcards, as above. --only works the same way when you want to upload just a few files.

How I use it

My usual loop: I build on a development or staging theme, preview locally, check with Theme Check and share a link before anything is published. What it does not give you is history: who changed what, and a way back. That is GitHub, in part 4.

Further reading