Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 61 ยท Getting Started

What Is a Shopify Theme?

Learn what a Shopify theme is, what it controls compared with apps, how Online Store 2.0 works and how a storefront request becomes a finished HTML page.

A Shopify store has two halves. The back office (the admin) is where a merchant manages products, orders, customers and settings. The storefront is the website shoppers actually visit. A theme is the package of files that decides how that storefront looks and behaves: the header, the product page, the cart page, the colors, the fonts and the layout of every section.

If you build themes, you are building the part of a store that customers see. Merchants can switch between themes without losing their products, and developers can ship the same theme to thousands of stores. That is why a theme is written as a set of reusable templates and settings, not as a fixed web page.

This lesson gives you the map. You will learn what a theme controls, what it cannot control, how a request for a URL turns into HTML, and what "Online Store 2.0" changed. Later lessons go deep on each part, starting with setting up your tools.

This tutorial targets current Shopify themes (Online Store 2.0 and newer, with JSON templates, sections everywhere and theme blocks). Shopify's Liquid engine and the real storefront run on Shopify's servers, so they cannot run inside this website. Real theme code is shown in read-only blocks. Every lesson also gives you live stand-ins written in JavaScript that imitate the idea so you can experiment, and each one says what is real and what is imitation.

Stores, themes and what lives where

Think of a Shopify store as three separate layers:

  • Data: products, collections, pages, blog posts, menus, customers, orders, metafields. This belongs to the merchant and lives in Shopify, not in the theme.
  • Theme: Liquid templates, CSS, JavaScript, images, translations and settings. It reads the data and turns it into HTML.
  • Apps and checkout: apps add features (reviews, subscriptions, upsells), and Shopify's checkout handles payment. A theme does not own either.

Because data and theme are separate, a merchant can duplicate a theme, edit the copy, preview it and publish it later. A store can hold many themes, but only one is live (published) at a time.

flowchart LR
  D["Store data<br/>products, pages, menus"] --> T["Theme<br/>templates, CSS, JS"]
  A["Apps<br/>blocks and embeds"] --> T
  T --> H["HTML page<br/>sent to the shopper"]
  C["Checkout<br/>managed by Shopify"] -.-> H

The theme combines store data and app content into the HTML a shopper sees. Checkout is separate and mostly outside theme control.

What a theme controls

A theme controls the look and structure of the online store pages:

  • the home page, collection pages, product pages, cart page, search results, blog, articles and ordinary pages;
  • the customer account pages, such as login and order history (depending on the account type, covered in Customer Accounts and Account Pages);
  • the global header, footer, navigation and announcement bars;
  • which sections appear on each page and in which order, when the theme uses the editor features;
  • the CSS, JavaScript, fonts, icons and images the storefront loads;
  • the settings a merchant can change in the theme editor, such as colors and typography.

What a theme does not control

  • Checkout. Payment, shipping and order confirmation pages are rendered by Shopify. Themes can only influence them in limited ways (for example, branding settings). See Cart, Discounts and the Path to Checkout.
  • The data model. A theme cannot add a new field to products. Merchants create fields with metafields, and the theme reads them (see Metafields in Themes).
  • Business rules. Tax calculation, discount logic, inventory and fulfilment happen in Shopify. Your theme can display results, never decide them. Shared ideas such as prices, taxes and the order lifecycle are explained in the e-commerce fundamentals track.
  • Features that need a server. If a feature needs its own database or background jobs (loyalty points, subscriptions), it is usually an app. Apps can still show their interface inside your theme through app blocks (see App Blocks and App Embeds).

A quick test when a client asks "can you add this?": if it only changes how existing data is shown, it is a theme task. If it creates new data, new rules or new server logic, it is probably an app or a Shopify setting.

What Online Store 2.0 changed

Early Shopify themes had a fixed template for each page type. A merchant could rearrange sections only on the home page. Everything else needed a developer.

Online Store 2.0, introduced in 2021, changed that:

  1. JSON templates. Page templates became small JSON files that list which sections appear and in what order. The merchant edits that list in the theme editor.
  2. Sections everywhere. Any page type (product, collection, blog, even custom pages) can be built from sections that the merchant adds, removes and reorders.
  3. App blocks. Apps can place blocks inside theme sections, so installing an app no longer means a developer pasting code into your files.
  4. Metafields in the editor. Merchants can connect custom data to settings without code (dynamic sources).

Newer themes go further with theme blocks: reusable block files shared by many sections, which can also be nested. You will meet these in Blocks and Theme Blocks. Everything in this tutorial assumes this modern model; old patterns are mentioned only so you can recognize them (see Migrating Legacy Themes to Online Store 2.0).

The life of a storefront request

When a shopper opens https://example-store.com/products/blue-mug, Shopify does the following on its servers:

  1. Route. It matches the URL to a template type. /products/<handle> is the product template.
  2. Load data. It finds the product with that handle and prepares objects such as product, shop, cart and settings.
  3. Pick the template. It reads the template file, for example templates/product.json.
  4. Render sections. The JSON lists sections. Each section is a Liquid file that is rendered with the data.
  5. Wrap in a layout. The result is inserted into layout/theme.liquid, which provides <html>, <head>, header and footer.
  6. Respond. The finished HTML goes to the browser, which then loads your CSS and JavaScript.
sequenceDiagram
  participant B as Browser
  participant S as Shopify server
  B->>S: GET /products/blue-mug
  S->>S: route to the product template
  S->>S: load product, shop, cart
  S->>S: render sections with Liquid
  S->>S: insert into theme.liquid
  S-->>B: finished HTML
  B->>S: request CSS, JS and images

Liquid runs on Shopify's servers before anything reaches the browser. The browser only ever receives HTML.

This server-side step matters. Liquid is not JavaScript and cannot react to clicks. If you want something to change after the page has loaded (add to cart without reloading, for example), you add JavaScript that talks to Shopify's storefront endpoints, covered in The Ajax Cart API.

Try the pipeline

The real Liquid engine is not available here, so this stand-in imitates the order of the steps with a tiny template function. The data, the section "files" and the layout are made up, but the sequence (route, data, sections, layout) mirrors the real one.

JS Stand-in: render a page like Shopify does

Press Run (or Ctrl + Enter) to see the console output here.

No output.

In the real engine the layout file uses the object {{ content_for_layout }} in exactly this way. You will see it in Layouts and theme.liquid.

What a theme looks like on disk

A theme is a folder with a fixed set of subfolders: layout, templates, sections, blocks, snippets, assets, config and locales. Here is a trimmed view of a typical theme. This is a read-only listing, not something you run:

TEXT
my-theme/
  layout/theme.liquid
  templates/index.json
  templates/product.json
  sections/header.liquid
  sections/main-product.liquid
  snippets/price.liquid
  assets/base.css
  config/settings_schema.json
  locales/en.default.json

The next lessons walk through each folder. The important point for now is that the folder names are fixed: Shopify looks for files only in these places and does not allow arbitrary extra subfolders for code.

Which URL maps to which template

The routing step is simple enough to model. This second stand-in lists the template types for common storefront URLs. It follows the real URL shapes (/collections/<handle>/products/<handle> still renders the product template), but it is a simplified version of Shopify's own router.

JS Stand-in: URL to template type

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Notice the order of the rules matters: the longer collection-plus-product pattern must be tested before the plain collection pattern. Real routers have the same kind of care about specificity.

Themes, the Theme Store and custom themes

You will meet three kinds of theme work:

  • Using a free or paid theme from the Shopify Theme Store and customizing it in the editor.
  • Customizing a theme for one merchant, editing Liquid, CSS and JavaScript for a specific store.
  • Building a theme to sell, which has to pass Shopify's review and work for many different stores (see Theme Store Requirements and Selling a Theme).

Most developers start by customizing an existing theme. The reference theme Dawn is the usual starting point, and we explore it in Exploring Dawn.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Where does Liquid code run?

    Liquid is rendered on the server. The browser receives finished HTML, so Liquid cannot respond to clicks after the page has loaded.
  2. 2. Which of these can a theme NOT do by itself?

    The data model belongs to the store. Merchants add custom fields with metafields, and the theme can only read and display them.
  3. 3. What is the main change Online Store 2.0 brought to templates?

    JSON templates plus sections everywhere let merchants add, remove and reorder sections on any page type, not only on the home page.
  4. 4. A shopper opens /collections/mugs/products/blue-mug. Which template type renders?

    The URL names a product inside a collection. The collection handle only gives context; the product template renders.

Summary

  • A theme is the set of files that turns store data into the storefront HTML.
  • Data, theme, apps and checkout are separate layers; themes do not own checkout, business rules or the data model.
  • Online Store 2.0 introduced JSON templates, sections everywhere and app blocks.
  • A request is routed to a template, data is loaded, sections are rendered with Liquid, and the result is wrapped in the layout.
  • Liquid runs on Shopify's servers; JavaScript handles anything that happens after the page loads.

Next, get your tools ready in Setting Up: Dev Store, Partner Account and Shopify CLI.