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.

init

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

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.

serve

Uploads the current theme as a development theme to the store that you're connected to, and returns the following information:

  • A link to your development theme at http://127.0.0.1:9292. This URL hot reloads local changes to CSS and sections, allowing you to preview changes in real time using the store's data. This preview is available only in Google Chrome.
  • A link to the online store editor for the theme.
  • A preview link that you can share with other developers.

If you already have a development theme for your current environment, then this command syncs the development theme with your local theme.

To preview your local changes at http://127.0.0.1:9292, you need to use Google Chrome.

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 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.

check

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

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> Run only the specified category of checks. You can specify multiple categories using multiple instances of this flag.
--exclude-category <CATEGORY> -x <CATEGORY> Run all checks other than those in the specified category. You can specify multiple categories using multiple instances of this flag.
--fail-level <LEVEL> Configure 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 fix correctable offenses.
--init Generate a new Theme Check config file.
--print Output the active config to STDOUT.
--list -l List the active checks.
--version -v Print the version of Theme Check being used.

pull

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

Parameter Short version Description
--themeid <THEMEID> -i <THEMEID> The ID of the theme that you want to pull.
--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:

  • Simple file names: templates/product.temp.json
  • Wildcards: config/*_secret.json, *.jpg
  • Regular expressions: /\.jpe?g$/

push

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:

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

Parameter Short version Description
--themeid <THEMEID> -i <THEMEID> The 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.
--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.
--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.
--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:

  • Simple file names: templates/product.temp.json
  • Wildcards: config/*_secret.json, *.jpg
  • Regular expressions: /\.jpe?g$/

publish

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 Publish the theme without confirming with the user.

package

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.

delete

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

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.

Next steps