Theme commands
This reference lists the theme commands that you can use with Shopify CLI. The commands in this group use the syntax shopify theme [command]
.
To access help for any of these commands from the command line, use shopify [command] -h
.
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.
Optional parameters
Anchor link to section titled "Optional parameters"Parameter | Short version | Description |
---|---|---|
NAME |
The name that you want to give your theme. Cloned files are stored in a folder with this name. | |
--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. |
Uploads the current theme as the specified theme, or a development theme, to the store that you're connected to.
This command also 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, allowing 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 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 only run this command in a directory that matches the default Shopify theme folder structure.
Optional parameters
Anchor link to section titled "Optional parameters"Parameter | Short version | Description |
---|---|---|
--live-reload <MODE> |
The level at which content is reloaded when changes are made to the theme. Accepts the following values:
|
|
--host=<IP> |
The network interface the web server listens on. The default value is 127.0.0.1. | |
--port=<PORT> |
The local port to serve the theme preview from. | |
--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 serve 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. |
|
--theme |
-t |
Specify the ID or name of the theme that you want to serve. If you don't use this flag, then the theme is served using a new or existing development theme. |
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.
Optional parameters
Anchor link to section titled "Optional parameters"Parameter | Short version | 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. |
--version |
-v |
Prints the version of Theme Check being used. |
Lists the themes in your store, along with their IDs and statuses.
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.
Parameter | Short version | Description |
---|---|---|
--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. |
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.
Optional parameters
Anchor link to section titled "Optional parameters"Parameter | Short version | Description |
---|---|---|
--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:
|
Uploads your local theme files to Shopify, overwriting the remote theme 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 only run this command 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:
Optional parameters
Anchor link to section titled "Optional parameters"Parameter | Short version | Description |
---|---|---|
--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:
|
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.
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 only run this command 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.
Parameter | Short version | Description |
---|---|---|
THEME_ID |
The ID of the theme that you want to publish. | |
--force |
-f |
Publishes the theme without confirming with the user. |
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.
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.
Optional parameters
Anchor link to section titled "Optional parameters"Parameter | Short version | Description |
---|---|---|
THEME_ID |
The ID of the theme that you want to delete. You can specify multiple theme IDs separated by spaces. | |
--development |
-d |
Deletes your development theme. |
--force |
-f |
Deletes the theme without confirming with the user. |
- Learn how to get started with Shopify CLI.
- Review the core commands for Shopify CLI.