Shopify Theme Editor: How to Edit & Customize Your Theme Code

Want more control over your Shopify store? The edit Shopify theme code lets you customize everything from layouts and colors to custom Liquid, HTML, and CSS. Whether you want to edit Shopify theme code or make changes with the visual editor, this guide, NextSky, covers everything you need to build your storefront exactly the way you want.

How to Open the Shopify Theme Editor

Getting into the theme editor is straightforward:

  1. Log in to your Shopify admin.
  2. Go to Online Store > Themes.
  3. Find your active theme and click Customize.

This opens the visual theme editor. From here, you can navigate to any page of your store, edit sections and blocks, adjust global settings like fonts and colors, and preview changes before publishing.

To access the code editor instead:

  1. Go to Online Store > Themes.
  2. Click the three-dot menu (⋯) next to your theme.
  3. Select Edit code.

Both editors are available from the same Themes page — the Customize button takes you to the visual editor, while Edit code opens the code editor.

How to edit a Shopify theme with the code editor

Step 1: Back Up Your Theme First

This step is non-negotiable. Before making any code changes, duplicate your theme:

  1. Go to Online Store > Themes.
  2. Click the three-dot menu on your active theme.
  3. Select Duplicate.

This creates an identical copy that remains untouched. If something breaks in the version you're editing, you can publish the backup and restore your store in minutes. Never skip this step.

Step 2: Understand the Folder Structure

When you open the Shopify code editor, you'll see a directory of files organized into folders. Here's what each one contains:

  • Layout: Contains theme.liquid, the master template for your store. It wraps every page and holds your header, footer, and the scripts and styles that load everywhere. Changes here affect your entire store.
  • Templates: Defines what content appears on each page type: product pages, collection pages, the homepage, blog posts, cart, and more. Online Store 2.0 themes use JSON templates, which reference sections rather than containing inline HTML.
  • Sections: The individual content components referenced by templates. Each section is a self-contained Liquid file with its own HTML, CSS, and schema. When you edit a section here, the change appears everywhere that section is used.
  • Snippets: Small, reusable Liquid files that can be included inside templates and sections using {% render 'snippet-name' %}. A good example is a reusable product card or a star rating component. Changing a snippet updates it everywhere it's referenced.
  • Assets: Stores static files: CSS stylesheets, JavaScript files, fonts, and images. This is where your theme.css and theme.js live, along with any custom files you add.
  • Config: Contains settings_schema.json and settings_data.json, which define the options available in your Theme Settings panel. These control what merchants can customize from the visual editor.
  • Locales: Holds translation files that allow your theme to display text in different languages. Useful for multilingual stores.

Step 3: Edit Your Theme Files

Click any file in the directory to open it in the editing area on the right. You can open multiple files in separate tabs and work between them. When a file has unsaved changes, a dot appears next to the tab name. Save with the Save button, or use ⌘+S (Mac) / Ctrl+S (Windows).

Shopify's Code Language: Understanding Liquid

The primary language used in Shopify theme files is Liquid, Shopify's open-source templating language. Liquid is what makes your pages dynamic, it pulls content from your store's backend (products, collections, customer data, cart items) and outputs it into your HTML templates.

Liquid uses three types of syntax:

  • Output tags {{ }}: Render a value. For example, {{ product.title }} outputs the name of the current product.
  • Logic tags {% %}: Handle conditionals and loops. For example, {% if product.available %} shows one thing if a product is in stock and another if it isn't.
  • Filters: Modify output values. For example, {{ product.price | money }} formats a price number into your store's currency format.

Here's a simple but practical example showing how Liquid handles conditional logic in a theme:

{% if product.available %}

{% else %}

Sold Out

{% endif %}

This snippet checks whether a product is available and renders either an Add to Cart button or a Sold Out message. You can find variations of this logic in almost every Shopify product template.

Alongside Liquid, Shopify theme files use:

  • HTML: Structures the content and layout of each page.
  • CSS: Controls the visual styling: colors, fonts, spacing, and responsive behavior.
  • JavaScript: Adds interactive functionality: dropdowns, sliders, quantity pickers, AJAX cart updates.
  • JSON: Used in template files and config settings to define schema and store merchant-configured values.

Adding custom css to your shopify theme

Custom CSS is one of the safest and most effective ways to modify how your store looks without risking your theme's core functionality. There are two ways to add custom CSS:

Through the Theme Editor (recommended for small changes)

Many Shopify themes include a Custom CSS field directly in the theme editor. Go to Theme Settings > Custom CSS (the exact location varies by theme) and paste your CSS there. This keeps your CSS out of the core theme files, which means it won't be lost if you update the theme.

Through the Code Editor

For more substantial CSS customization, create a separate file in the Assets folder:

  1. In the Code Editor, right-click the Assets folder.
  2. Select Add a new file.
  3. Name it custom.css.
  4. Add your CSS rules to this file.
Then link the file in theme.liquid by adding this line in the section:

{{ 'custom.css' | asset_url | stylesheet_tag }}

Keeping your custom styles in a separate file makes it easy to identify your changes, avoids conflicts with theme updates, and keeps the codebase cleaner for anyone maintaining the store later.

Adding custom javascript to your Shopify Theme

Custom JavaScript lets you add interactive features that don't exist in your theme by default. Things like custom quantity selectors, dynamic filters, scroll-triggered effects, or third-party integrations.

The process mirrors custom CSS:

  1. In the Code Editor, right-click the Assets folder.
  2. Create a new file named custom.js.
  3. Write your JavaScript inside it.
In theme.liquid, add this line before the closing tag:

{{ 'custom.js' | asset_url | script_tag }}

For smaller scripts that only need to apply to a specific template, you can add them inline directly inside the relevant template or section file, wrapped in
Looking for Help?
Get support from our team

If you can't find the answer you're looking for, our support team is here to help.