Shopify CLI Commands

Updating

Shopify CLI is under continuous development. New releases are released frequently fixing bugs or adding new features.

To check for the latest releases and what changes they introduce please visit Shopify CLI releases

If you wish to update, download the appropriate version from the releases page. Then follow the instructions for your platform on this page.

For Linux users:

sudo apt install /path/to/downloaded/shopify-cli-x.y.z.deb

For macOS and Windows users using RubyGems:

gem update shopify-cli

Useful commands

  1. shopify login --store <store_url>

Logs you into the specified store.

The specified store can be a development store or a Shopify store. You need to have collaborator access to the store, or be a staff member or owner of the store.

You can’t use Shopify CLI with development stores if you only have Partner staff member access. If you want to use Shopify CLI to work on a development store, then you should be the store owner or create a staff account on the store.

If you’re the store owner, then you need to log in to the store directly using the store URL at least once (for example, using {shop}.myshopify.com/admin) before you log in using Shopify CLI. Logging in to the Shopify admin directly connects the development store with your Shopify login.

  1. shopify switch --store <store_url>

Switches between stores without logging out and logging in again.

If you enter this command without a –store flag, then you’re prompted to select a store associated with your account.

  1. shopify whoami

Determines which Partner organization you’re logged in to, or which store you’re logged in to as a staff member.

  1. shopify store

Displays the store that you are currently connected to.

  1. shopify theme serve

Uploads the current theme as a development theme to the store that you’re connected to.

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

You can’t preview checkout customizations using http://127.0.0.1:9292.

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.

  1. shopify theme open

Returns links that let you preview the specified theme.

If you don’t specify a theme (using --theme <name_or_id>), then you’re prompted to select the theme to open from the list of the themes in your store.

  1. shopify theme pull

Retrieves theme files from Shopify.

If no theme is specified (using --theme <name_or_id>), then you’re prompted to select the theme to pull from the list of the themes in your store.

Use the --only option to download only the specified files. Specify multiple patterns by using the flag multiple times in a single command. Accepts references to files in the following formats:

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

Tip: To save theme customiser settings from a development theme, while its still active, you can use: shopify theme pull -o 'templates/*.json' -o 'config/settings_data.json ./_backup This will copy the settings_data file and all OS2 json page templates into a _backup folder.

  1. shopify theme 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.

Use the --unpublished flag to upload the theme to the theme library as a new unpublished theme. You’re prompted to provide a name for the theme.

Use the --only option to upload only the specified files. See the description under shopify theme pull for more details.

  1. shopify theme list

Lists all the themes in your store, along with their IDs and statuses.

  1. shopify logout

Logs you out of the Shopify account or Partner account and store.