Create a Shopify Local Environment using Shopify Theme Kit

If you want to start developing Shopify themes, then one option is using the Shopify Theme Kit provided by Shopify for developers.

This article assumes you have created your Shopify store, and are ready to start developing your theme locally.

Table of Contents:

  1. Installing the Shopify Theme Kit
  2. Create a private app for API key
  3. Get the theme ID from your account
  4. Create theme directory and download theme
  5. Watch for theme changes

1. Installing the Shopify Theme Kit

To install the Shopify Theme Kit on a linux system, use the following command to install:

curl -s https://shopify.github.io/themekit/scripts/install.py | sudo python

Alternatively, you can use this command for windows-based installations:

choco install themekit

If you are using a MacOS, you can install the HomeBrew package and then install the Shopify Theme Kit:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew tap shopify/shopify
brew install themekit

To make sure the themekit is installed properly, just type the theme command to get help options:

theme

2. Create a private app for API key

Next we will need to go to Shopify and click on “Apps” on the left and then “Manage private apps”. On the next screen, click on “Create a new private app” to start making a new app.

Enter your app name and your developer email, and then under the “Admin API” section, make sure that you have read and write access for each option to allow you to use the theme kit through command line to perform actions on your Shopify Store. Once that is done, save the app to get your API Key and other credentials.

3. Get the theme ID from your account

If you are creating a new theme, you can skip this step. Otherwise, you will need to get your theme ID from the Shopify console or command line.

3.1 Get theme ID from command line

To get the theme ID from the command line, open up a terminal and use the list command:

theme get --list -p=[your-password] -s=[you-store.myshopify.com]

This will list all the themes that exist in your Shopify account with their IDs.

3.2 Get theme ID from console

In order to do this using your Shopify console, login to your Shopify store, click on “Online Store” in the left admin menu and then click on “Customize” on the theme you are trying to develop.

On the page that opens, you should notice a number after the /themes/ url path. This number is your theme ID, so take note of this number.

4. Create theme directory and download theme

Next we will create the theme directory on your local machine using command line and download the theme. Open a terminal and type the following commands individually while replacing the variable values with your own:

cd desktop
sudo mkdir [name-of-your-directory]
cd [name-of-your-directory]

If you are creating a new theme, use the following command replacing the appropriate values:

theme new --password=[your-password] --store=[your-store.myshopify.com] --name=[theme name]

Otherwise, you can use the theme ID you found in step 3 to get the theme you would like to work with:

theme get -p=[your-password] -s=[you-store.myshopify.com] -t=[your-theme-id]

5. Watch for theme changes

Finally, you just have to watch for changes in your local environment theme folder by using the watch command:

theme watch

That’s it! Now you can update, delete, and add files to your theme folder and the changes will be mirrored up to your Shopify account.