Facebook iconHow To Use Shopify CLI for Themes (A Step-by-Step Guide)
Blogs/Shopify

How To Use Shopify CLI for Themes (A Step-by-Step Guide)

Jan 9, 20254 Min Read
Written by Sahil Singh
How To Use Shopify CLI for Themes (A Step-by-Step Guide) Hero

When working on Shopify stores, developers often face a common challenge: finding the corresponding CSS styles or JavaScript functions for elements with specific classes, IDs, and attributes. In a live Shopify environment, this means manually searching through multiple files to locate where these selectors are being used – be it stylesheets, theme files, or JavaScript modules.

This process is much simpler in local development environments like Visual Studio Code. There, you can simply copy a class name, ID, or attribute, use the global search feature (Ctrl+Shift+F or Cmd+Shift+F), and instantly see all occurrences across your project files. The search results clearly show which files contain these selectors and provide context, making it much easier to trace how an element is being styled or manipulated.

Not just this, working on the Shopify store has its fair share of shortfalls.

1. When multiple developers need to collaborate on a single theme, they must each create separate theme copies. This is necessary because simultaneous work on the same theme can lead to code conflicts, where one developer's changes might accidentally override another's modifications.

2. It’s hard to keep track of all the changes as there is no proper version control system

Without a proper version control system, tracking changes across theme files becomes challenging. This is where Shopify CLI comes in handy - it's a command line interface that allows you to work on themes locally, preview changes, and deploy updates through your terminal. By developing locally, you can integrate your theme files with GitHub, providing robust version control and eliminating issues with code conflicts and change tracking.

Here is a step-by-step guide for working on themes locally using a Shopify CLI,

1. Pre-requisites

Before the steps make sure to have the,

Node.js: 18.20+, 20.10 or higher
A Node.js package manager: npm, Yarn 1.x, or pnpm.
Git: 2.28.0 or higher

2. Install Shopify CLI Globally

Paste the following command to your terminal.

npm install -g @shopify/cli@latest
Installing Shopify CLI Globally

3. Pull the theme to which you want to work locally

After Installing the Shopify CLI, use the following command to pull the theme files to your local system.

 shopify theme pull --store store_name_here.myshopify.com
Shopify theme pull

You will then be redirected to the browser for login verification, Once confirmed with the login.

In your terminal, you'll see a list of all theme files currently in your store. From here, you'll need to select the specific theme you want to work on.

Once selected, the CLI will begin downloading the theme files to your local system.

Once the download completes, you can access all the theme files in your local directory.

4. Use the Shopify theme dev for previewing the changes while working on the theme locally

Use the following command while working on the theme locally to see the changes in preview

shopify theme dev
Use the Shopify theme dev for previewing the changes while working on the theme locally

Click [1] to open the theme preview or [2] to access the theme editor.

Let's try to make some changes in the theme file

In the index file, Lets change the heading for the banner image from “Equip Yourself with Our Latest Camping Gear”

Partner with Us for Success

Experience seamless collaboration and exceptional results.

Collection to something else,

As you edit the file, your changes will automatically reflect in the preview window.

And In the terminal also

6. Use Command Theme Push to push the changes from local to store

Once done with all the changes use the command below,

shopify theme push

Next, select the theme file to which you want your changes to be pushed to

On confirmation, the Shopify CLI will start uploading files to the store

Once Completed the Terminal would show the message of success,

The Changes would reflect on the live website or on the theme to which you have pushed your code.

And that's it!!!

Partner with Us for Success

Experience seamless collaboration and exceptional results.

Our Final Words

I hope this guide has shown you how Shopify CLI can streamline your theme development workflow. By working locally, you can leverage your favorite IDE features, collaborate effectively with team members through Git version control, and maintain better oversight of your code changes.

This approach not only enhances productivity but also makes theme development more organized and efficient.

Need expert help?

Looking to enhance your Shopify store but not sure where to start? F22 Labs specializes in custom Shopify development and optimization. Our team of certified Shopify experts can help transform your e-commerce vision into reality, offering tailored solutions from theme customization to full-scale store development. Contact us to elevate your online store.

Author-Sahil Singh
Sahil Singh

I’m a Front-End developer with 1.3 years of experience creating user-friendly, optimized web pages. I specialize in developing features that boost conversion rates for e-commerce websites.

Phone

Next for you

How Do I Add Product Recommendations to My Shopify Cart Drawer? Cover

Shopify

Dec 3, 20249 min read

How Do I Add Product Recommendations to My Shopify Cart Drawer?

Maximizing every opportunity to increase sales is crucial. One often overlooked yet powerful strategy is utilizing the cart page to showcase recommended products. This guide will walk you through the process of adding product recommendations to your Shopify cart page, potentially boosting your conversion rates and average order value. Customers who've added items to their cart are actively considering a purchase and they're often receptive to product suggestions aligned with their initial choic

4 Ways to Increase AOV of Your Shopify Store in 2025 Cover

Shopify

Nov 27, 20246 min read

4 Ways to Increase AOV of Your Shopify Store in 2025

Learning how to increase the average order value of a Shopify store is crucial for sustainable business growth. If your store has a decent amount of traffic and a conversion rate, yet you are still not satisfied with the sales and want the numbers to go up, focusing on Shopify's average order value can help bridge the gap between your current sales and the benchmark that you have set up for the sales target. What is Average Order Value and Why does it matter? Understanding the average order v

15 Top Shopify SEO Tools for Your Store Growth Cover

Shopify

Oct 28, 202411 min read

15 Top Shopify SEO Tools for Your Store Growth

Search Engine Optimization (SEO) is key to boosting visibility and driving organic traffic. With Statista forecasting global e-commerce sales to reach US$4,117.00bn in 2024, the potential for online retail growth is immense. Harnessing this opportunity requires leveraging the most effective Shopify SEO tools. This guide delves into 15 premier Shopify SEO tools that can catalyze your store's growth and enhance its search engine performance. Whether you're hunting for the best SEO app for Shopify