Shopify CLI commands for themes
This reference lists the commands that you can use to build themes with Shopify CLI.
The commands in this group use the syntax shopify [topic] [command]
.
Command overview
Anchor link to section titled "Command overview"Topic | Command | Description |
---|---|---|
theme | init | Clones a Git repository to your local machine to use as the starting point for building a theme. |
dev | Uploads the current theme to a store so you can preview it. | |
check | Calls and runs Theme Check to analyze your theme code for errors and to ensure that it follows theme and Liquid best practices. | |
list | Lists the themes in your store. | |
open | Returns links that let you preview the specified theme. | |
pull | Retrieves theme files from Shopify. | |
push | Uploads your local theme files to Shopify, overwriting the remote version if specified. | |
share | Uploads your theme as a new, unpublished theme in your theme library. | |
publish | Publishes an unpublished theme from your theme library. | |
package | Packages your local theme files into a ZIP file that can be uploaded to Shopify. | |
delete | Deletes a theme from your store. | |
language-server | Starts a Language Server Protocol server. | |
console | Starts the Shopify Liquid REPL (read-eval-print loop) tool. | |
info | Displays information about your theme environment. | |
auth | logout | Logs you out of your Shopify account. |
config | autocorrect | Enables or disables command autocorrection. |
none | help | Lists the available commands and describes what they do. |
version | Displays the version of Shopify CLI that you're running. | |
upgrade | Upgrades the @shopify/cli and @shopify/theme packages to their latest versions. |
|
search | Starts a search on Shopify.dev. |
Clones a Git repository to your local machine to use as the starting point for building a theme.
If no Git repository is specified, then this command creates a copy of Dawn, Shopify's example theme, with the specified name in the current folder. If no name is provided, then you're prompted to enter one.
Argument | Description |
---|---|
name |
The name that you want to give your theme. Cloned files are stored in a folder with this name. |
Flag | Alias | Description |
---|---|---|
--clone-url <URL> |
-u <URL> |
The URL of the Git repository that you want to clone. If no URL is specified, then https://github.com/Shopify/dawn.git is used. |
--latest |
Clone the latest release from the repository, rather than the content of the repository's main branch. | |
--path <PATH> |
The path to your theme directory. | |
--verbose |
Provides more detailed output in the logs. | |
--no-color |
Disables color output in the logs. |
Uploads the current theme as the specified theme, or a development theme, to a store so you can preview it.
This command returns the following information:
A link to your development theme at http://127.0.0.1:9292. This URL can hot reload local changes to CSS and sections, or refresh the entire page when a file changes, enabling you to preview changes in real time using the store's data.
You can specify a different network interface and port using
--host
and--port
.A link to the editor for the theme in the Shopify admin.
A preview link that you can share with other developers.
If you already have a development theme for your current environment, then this command replaces the development theme with your local theme. You can override this using the --theme-editor-sync
flag.
Development themes are deleted when you run shopify auth logout
. If you need a preview link that can be used after you log out, then you should share
your theme or push
to an unpublished theme on your store.
You can run this command only in a directory that matches the default Shopify theme folder structure.
Flag | Alias | Description |
---|---|---|
--store <store> |
-s <store> |
The development store that you want to use to preview your theme. The --store flag accepts the following inputs:
|
--password |
A custom app access token or Theme Access password for the store. | |
--theme <NAME_OR_ID> |
-t <NAME_OR_ID> |
The ID or name of the theme that you want to preview. If you don't use this flag, then the theme is previewed using a new or existing development theme. |
--host <IP> |
The network interface that the web server listens on. The default value is 127.0.0.1. | |
--port <PORT> |
The local port to serve the theme preview from. | |
--live-reload <MODE> |
The level at which content is reloaded when changes are made to the theme. Accepts the following values:
|
|
--poll |
Forces the polling adapter to watch file changes. You can try this option if live reload isn't working as expected. | |
--theme-editor-sync |
Enables two-way sync for theme JSON files. When this option is enabled, changes made in the theme editor in the Shopify admin are applied to the local copy of the theme. If you run the dev command with this flag and you already have a development theme for your current environment, then the local and remote themes are compared. If there are any differences between files in the local copy of the theme and remote development theme, then the differing files are listed. You're prompted to overwrite your local or remote version, or merge the files. |
|
--ignore |
-x |
Skips hot reloading any files that match the specified pattern. Specify multiple patterns to ignore by using the flag multiple times in a single command. If a file matches both the pattern specified in --only and --ignore , then the file is ignored.If files are excluded using .shopifyignore, then both the contents of .shopifyignore and the --ignore flag are respected. Accepts references to files in the following formats:
|
--only |
-o |
Hot reloads only files that match the specified pattern. Specify multiple patterns by using the flag multiple times in a single command. Accepts references to files in the following formats:
|
--environment <ENV_NAME> |
-e <ENV_NAME> |
The environment that you want to use. |
--path <PATH> |
The path to your theme directory. | |
--notify <PATH_OR_URL> |
The file path or URL to notify when an event occurs. The file path is to a file that you want to be updated when workers have gone idle. The URL path is where you want a webhook posted to report on file changes. | |
--verbose |
Provides more detailed output in the logs. | |
--no-color |
Disables color output in the logs. |
Calls and runs Theme Check to analyze your theme code for errors and to ensure that it follows theme and Liquid best practices. Learn more about the checks that Theme Check runs.
check flags
Anchor link to section titled "check flags"Flag | Alias | Description |
---|---|---|
--config <PATH> |
-C <PATH> |
The path to your custom Theme Check config. This config overrides .theme-check.yml , if it is present in the directory being analyzed. |
--category <CATEGORY> |
-c <CATEGORY> |
Runs only the specified category of checks. You can specify multiple categories using multiple instances of this flag. |
--exclude-category <CATEGORY> |
-x <CATEGORY> |
Runs all checks other than those in the specified category. You can specify multiple categories using multiple instances of this flag. |
--fail-level <LEVEL> |
The severity level that causes a run of theme check to fail (exit code 1). Options include error , suggestion , and style . |
|
--auto-correct |
-a |
Automatically fixes correctable offenses. |
--init |
Generates a new Theme Check config file. | |
--output |
-o |
Outputs the results of the check to a file. Options include json and text (default). |
--print |
Outputs the active config to STDOUT. | |
--list |
-l |
Lists the active checks. |
--environment <ENV_NAME> |
-e <ENV_NAME> |
The environment that you want to use. |
--version |
-v |
Prints the version of Theme Check being used. |
--path <path> |
The path to your theme directory. | |
--verbose |
Provides more detailed output in the logs. |
Lists the themes in your store, along with their IDs and statuses.
Flag | Alias | Description |
---|---|---|
--store <store> |
-s <store> |
The development store that you want to use to preview your theme. The --store flag accepts the following inputs:
|
--password |
A custom app access token or Theme Access password for the store. | |
--role <role> |
Only list themes with the given role. Must be one of the following roles:
|
|
--name <name> |
Only list themes that contain the given string in their name. | |
--id <ID> |
Only list the theme with the given ID. | |
--environment <ENV_NAME> |
-e <ENV_NAME> |
The environment that you want to use. |
--verbose |
Provides more detailed output in the logs. | |
--no-color |
Disables color output in the logs. |
Returns links that let you preview the specified theme. The following links are returned:
- A link to the editor for the theme in the Shopify admin.
- A preview link that you can share with other developers.
If you don't specify a theme, then you're prompted to select the theme to open from the list of the themes in your store.
Flag | Alias | Description |
---|---|---|
--store <store> |
-s <store> |
The development store that you want to use to preview your theme. The --store flag accepts the following inputs:
|
--password |
A custom app access token or Theme Access password for the store. | |
--theme <NAME_OR_ID> |
-t <NAME_OR_ID> |
The name or ID of the theme that you want to open. |
--live |
-l |
Returns links for the live (published) theme. This option doesn't require --theme . |
--development |
-d |
Returns links for your development theme. This option doesn't require --theme . |
--editor |
-e |
Opens the theme editor for the specified theme in your browser. |
--environment <ENV_NAME> |
-e <ENV_NAME> |
The environment that you want to use. |
--verbose |
Provides more detailed output in the logs. | |
--no-color |
Disables color output in the logs. |
Retrieves theme files from Shopify.
If no theme is specified, then you're prompted to select the theme to pull from the list of the themes in your store.
Flag | Alias | Description |
---|---|---|
--store <store> |
-s <store> |
The development store that you want to use to preview your theme. The --store flag accepts the following inputs:
|
--password |
A custom app access token or Theme Access password for the store. | |
--theme <NAME_OR_ID> |
-t <NAME_OR_ID> |
The name or ID of the theme that you want to pull. |
--live |
-l |
Pulls the live (published) theme. This option doesn't require --theme . |
--development |
-d |
Downloads theme files from your remote development theme. You might use this command to copy changes made to the development theme in the theme editor to your local copy of the theme. This option doesn't require --theme . |
--nodelete |
-n |
Runs the pull command without deleting local files. |
--ignore |
-x |
Skips downloading the specified files from Shopify. Specify multiple patterns to ignore by using the flag multiple times in a single command. If files are excluded using .shopifyignore, then both the contents of .shopifyignore and the --ignore flag are respected. Accepts references to files in the following formats:
|
--only |
-o |
Downloads only the specified files from Shopify. Specify multiple patterns by using the flag multiple times in a single command. Accepts references to files in the following formats:
|
--environment <ENV_NAME> |
-e <ENV_NAME> |
The environment that you want to use. |
--path <PATH> |
The path to your theme directory. | |
--verbose |
Provides more detailed output in the logs. | |
--no-color |
Disables color output in the logs. |
Uploads your local theme files to Shopify, overwriting the remote version if specified.
If no theme is specified, then you're prompted to select the theme to overwrite from the list of the themes in your store.
You can run this command only in a directory that matches the default Shopify theme folder structure.
This command returns the following information:
- A link to the editor for the theme in the Shopify admin.
- A preview link that you can share with others.
If you use the --json
flag, then theme information is returned in JSON format, which can be used as a machine-readable input for scripts or continuous integration.
Sample output:
Flag | Alias | Description |
---|---|---|
--store <store> |
-s <store> |
The development store that you want to use to preview your theme. The --store flag accepts the following inputs:
|
--password |
A custom app access token or Theme Access password for the store. | |
--theme <NAME_OR_ID> |
-t <NAME_OR_ID> |
The name or ID of the theme that you want to overwrite. |
--development |
-d |
Pushes to your development theme. If you don't have a development theme, then one is created. This option doesn't require --theme . |
--nodelete |
-n |
Pushes your local files without deleting remote files from Shopify. |
--json |
-j |
Returns information about the pushed theme as a JSON object. |
--allow-live |
-a |
Allows Shopify CLI to overwrite the live (published) theme. |
--live |
-l |
Pushes to the live (published) theme. This option doesn't require --theme or --allow-live . |
--publish |
-p |
After the theme is pushed, publishes the theme so it is live in the store. |
--unpublished |
-u |
Uploads the theme to the theme library as a new unpublished theme. You're prompted to provide a name for the theme. Use the --theme flag to provide a name as a part of the command. |
--ignore |
-x |
Skips uploading the specified files to Shopify. Specify multiple patterns to ignore by using the flag multiple times in a single command. If files are excluded using .shopifyignore, then both the contents of .shopifyignore and the --ignore flag are respected.Accepts references to files in the following formats:
|
--only |
-o |
Uploads only the specified files to Shopify. Specify multiple patterns by using the flag multiple times in a single command. Accepts references to files in the following formats:
|
--environment <ENV_NAME> |
-e <ENV_NAME> |
The environment that you want to use. |
--path <PATH> |
The path to your theme directory. | |
--verbose |
Provides more detailed output in the logs. | |
--no-color |
Disables color output in the logs. |
Uploads your theme as a new, unpublished theme in your theme library. The theme is given a randomized name.
This command returns a preview link that you can share with others.
share flags
Anchor link to section titled "share flags"Flag | Alias | Description |
---|---|---|
--store <store> |
-s <store> |
The development store that you want to use to preview your theme. The --store flag accepts the following inputs:
|
--password |
A custom app access token or Theme Access password for the store. | |
--environment <ENV_NAME> |
-e <ENV_NAME> |
The environment that you want to use. |
--path <PATH> |
The path to your theme directory. | |
--verbose |
Provides more detailed output in the logs. | |
--no-color |
Disables color output in the logs. |
Publishes an unpublished theme from your theme library.
If no theme ID is specified, then you're prompted to select the theme that you want to publish from the list of themes in your store.
You can run this command only in a directory that matches the default Shopify theme folder structure.
If you want to publish your local theme, then you need to run shopify theme push
first. You're asked to confirm that you want to publish the specified theme. You can skip this confirmation using the --force
flag.
publish flags
Anchor link to section titled "publish flags"Flag | Alias | Description |
---|---|---|
--store <store> |
-s <store> |
The development store that you want to use to preview your theme. The --store flag accepts the following inputs:
|
--password |
A custom app access token or Theme Access password for the store. | |
--theme <NAME_OR_ID> |
-t <NAME_OR_ID> |
The name or ID of the theme that you want to publish. |
--force |
-f |
Publishes the theme without confirming with the user. |
--environment <ENV_NAME> |
-e <ENV_NAME> |
The environment that you want to use. |
--verbose |
Provides more detailed output in the logs. | |
--no-color |
Disables color output in the logs. |
Packages your local theme files into a ZIP file that can be uploaded to Shopify.
Only folders that match the default Shopify theme folder structure are included in the package.
The ZIP file uses the name theme_name-theme_version.zip
, based on parameters in your settings_schema.json file.
package flags
Anchor link to section titled "package flags"Flag | Description |
---|---|
--path <PATH> |
The path to your theme directory. |
--verbose |
Provide more detailed output in the logs. |
--no-color |
Disables color output in the logs. |
Deletes a theme from your store.
You can specify multiple themes by ID. If no theme is specified, then you're prompted to select the theme that you want to delete from the list of themes in your store.
You're asked to confirm that you want to delete the specified themes before they are deleted. You can skip this confirmation using the --force
flag.
delete flags
Anchor link to section titled "delete flags"Flag | Alias | Description |
---|---|---|
--store <store> |
-s <store> |
The development store that you want to use to preview your theme. The --store flag accepts the following inputs:
|
--password |
A custom app access token or Theme Access password for the store. | |
--theme <NAME_OR_ID>... |
-t <NAME_OR_ID>... |
The name or ID of the theme or themes that you want to delete. |
--show-all |
-a |
Shows development themes created by others in the theme list. |
--development |
-d |
Deletes your development theme. |
--force |
-f |
Deletes the theme without confirming. |
--environment <ENV_NAME> |
-e <ENV_NAME> |
The environment that you want to use. |
--verbose |
Provides more detailed output in the logs. | |
--no-color |
Disables color output in the logs. |
language-server
Anchor link to section titled "language-server"Starts a Language Server Protocol server.
language-server flags
Anchor link to section titled "language-server flags"Flag | Description |
---|---|
--verbose |
Provide more detailed output in the logs. |
--no-color |
Disables color output in the logs. |
Starts the Shopify Liquid REPL (read-eval-print loop) tool. This tool provides an interactive terminal interface for evaluating Liquid snippets and exploring Liquid objects, filters, and tags using real store data.
To start the tool, use the command:
You can also provide context to the console using a URL, as some Liquid objects are context-specific. For example:
console flags
Anchor link to section titled "console flags"Flag | Alias | Description |
---|---|---|
--store <store> |
-s <store> |
The development store that you want to use to preview your data in the console. The --store flag accepts the following inputs:
|
--password |
Your Theme Access password for the store. | |
--environment <ENV_NAME> |
-e <ENV_NAME> |
The environment that you want to use. |
--port <PORT> |
The local port to serve the authentication server. | |
--url <URL> |
The URL used as context for the console data. Some Liquid objects and entrypoints are only available in specific templates, or return different values in different contexts. If you don't provide a URL, then the code that you provide is run in the context of the store's index page (/ ). Learn more about object access. |
|
--verbose |
Provides more detailed output in the logs. | |
--no-color |
Disables color output in the logs. |
Displays information about your theme environment, including your current store.
Flag | Description |
---|---|
--verbose |
Provide more detailed output in the logs. |
--no-color |
Disables color output in the logs. |
Logs you out of the Shopify account or Partner account.
config autocorrect
Anchor link to section titled "config autocorrect"Enables or disables command autocorrection. By default, autocorrect is off.
When autocorrection is enabled, Shopify CLI automatically runs a corrected version of your command if a correction is available.
When autocorrection is disabled, you need to confirm that you want to run corrections for mistyped commands.
Command | Description |
---|---|
on |
Enable autocorrect. |
off |
Disable autocorrect. |
status |
Check whether autocorrect is enabled or disabled. |
Lists the available commands and describes what they do.
You can add a help flag to any command to learn more about it. Use --help
or -h
.
Displays the version of Shopify CLI that you're running.
Upgrades the @shopify/cli
and @shopify/theme
packages to their latest versions.
Starts a search on Shopify.dev.
Search the Shopify.dev docs by optionally passing a query argument to the command.
- Learn how to get started with Shopify CLI.