What's Shopify CLI

A command line interface for developing Shopify themes and apps.

Shopify CLI for themes

Shopify CLI Command list

The commands change depending on the version of the Shopify CLI. This article deals with 3.x.

Shopify CLI commands for themes

Prerequisites

You need to create a Shopify partner account and then either create a development store, connect to an existing store, or gain collaborator access permission to an existing store, and log in to these accounts with the system's default browser.

shopify theme

shopify theme init

shopify theme init [name]

A command to clone the Shopify theme on Git.
If nothing is specified, Dawn will be cloned.

shopify theme pull

shopify theme pull

Download a theme from your store.

There are several flags (optional arguments) available, but if you do not specify anything, a list of themes will be displayed and you can choose the theme you wish to download.

Since files for the specified theme will be downloaded, if you wish to separate folders by theme, create a folder for each theme, move to that directory, and then use the command.

shopify theme dev

Upload theme codes from your local computer to preview environment. This will allow you to preview your store. The theme in the production environment will not be overwritten.

shopify theme dev

The terminal will show you a message like below:


Message displayed after "shopify theme dev"

Message displayed after "shopify theme dev"

You can preview your store from the URL shown in your terminal.

In addition to this message, other URLs will also be issued, such as the URL to access the theme's edit menu.

Once you access the preview page, you will see a Share button at the bottom of the page. Clicking this button, then a URL for sharing is shown up so you can send this URL so that others can also preview the site.

The preview is ended by pressing Ctrl + Shift C in your terminal.

shopify theme publish

Upload the theme codes to the production environment. This means that the theme in the production environment will be overwritten.

shopify theme publish

Add a theme from GitHub, then you can publish modifications with git push

Shopify also allows you to add theme on GitHub.

In the theme adding menu, click the link "Connect from GitHub", and follow the message displayed to connect.

When you connect a theme from GitHub, you can publish modifications you made with "git push" to the repository you connected to Shopiy.


menu for connecting Shopify theme from GitHub

Shopify themes can also be added from GitHub


Author Info
Profile Icon

Director of web and marketing

Kota Shimizu

I've been working in web, video, and magazine production fields, experienced planning, design, photography, coding, marketing, and business improvement. I'm an omnivorous director who can handle anything in a widely.