Shopify5 min read

Build a Shopify theme from scratch, with Liquid

A complete storefront built from an empty folder on a real development store, in six parts: Liquid, section groups and JSON templates, theme blocks and the editor, the Cart API and a drawer, search, metafields and a second language, then Lighthouse, Theme Check and publishing.

By Abhishek Fouzdar

A Shopify theme is the part of a store a buyer actually touches, and most of the people who edit one have never built one. They start from Dawn or Horizon, change what they can find, and learn Liquid one error at a time. This series builds a theme from an empty folder on a real development store, in six parts, with every command run and every output shown, and ends with the theme published, packaged, and audited. Shopify CLI 4.9, Online Store 2.0 with theme blocks, Tailwind 4 compiled to a static stylesheet, on 3 November 2026.

The store is Saanjh Living, the home-goods development store from the Shopify app series: forty products with real photographs, variants with stock, sale prices, metafields for material and care, seventeen collections and a journal. The theme is called Lantern. It is a complete storefront, not a demo: home, collection, product, cart with a drawer, search with suggestions, blog, pages, 404, password, a second language, and a merchant-editable home page.

The home page of the Lantern theme: a hero with a brass lantern photo, Shop by collection tiles, a Most loved this month grid, a raised band with a table lamp and Eleven workshops, one standard, and a newsletter form

Who this is for

You build for the web and have a Shopify store in front of you, or you have customised a theme and want to know what is underneath the editor. Nothing about Liquid or the theme architecture is assumed; every object, tag and filter is explained where it is first used, and every part ends with what went wrong while writing it. The JavaScript is about two hundred lines in total and every one of them fetches HTML from Shopify rather than rebuilding it in the browser.

What you will end up with

A public repository, shipbytes/lantern-theme, one commit per part, 53 files, Theme Check clean on every rule it has, a Lantern-1.0.0.zip any store can upload, Lighthouse accessibility and best practices at 100 on the home, product and collection pages, and a working knowledge of the parts of theme development that tutorials skip: section groups, JSON templates, theme blocks, the font picker, the Section Rendering API, bundled section rendering on the Cart API, locale files, and what customer accounts have become.

Piece What it teaches
The folder and the layout What each directory is for, content_for_header and content_for_layout, section groups for the header and footer, a section's schema, JSON templates, theme settings turned into CSS variables that Tailwind's tokens read.
Product and collection pages Liquid's objects, tags and filters on the two pages that use most of them: a gallery from product.media, a price snippet, a variant picker from options_with_values with per-value availability, responsive images, sorting, pagination.
Sections, blocks and the editor Theme settings versus section settings and every input type, the font picker and the four font filters, section blocks, the blocks/ directory, content_for 'blocks', the home page as JSON, and what it all looks like to the merchant.
Variants, cart and drawer A variant change that fetches the product section and swaps what changed, add to cart through /cart/add.js with the drawer rendered in the same response, a <dialog> drawer, /cart/change.js, and the accessibility that goes with it.
Search, metafields, languages Predictive search through a fetched section, a search page with type chips, pagination as one snippet, metafields of three types on the product page, a complete Hindi locale with a selector, and new customer accounts.
Shipping it Lighthouse behind a store password, the audits that fired and their fixes, why mobile scores on a slow laptop cannot be trusted, Theme Check with all 85 rules, theme package, theme publish, and the Theme Store's bar.

The parts

  1. The anatomy of a theme, and one that renders. The folders, the CLI, the layout, header and footer as section groups, a section's schema, JSON templates for every page type, Tailwind compiled from theme settings, Theme Check, and the first push.
  2. Liquid on the product and collection pages. Objects, tags and filters; {% liquid %}; a gallery from product.media with image_url | image_tag; a price snippet with three states; a variant picker whose every value is a link; sorting through sort_by; cards with badges and hover images.
  3. Sections, blocks and the theme editor. Two kinds of settings and a table of the input types; font_picker with font_face, font_modify, font_url and preload_tag; a collection list from section blocks; theme blocks and content_for 'blocks'; a newsletter from {% form 'customer' %}; the home page as JSON; the editor with the blocks selected.
  4. Variants without reloads, the Cart API and a cart drawer. option_values and section_id, regions marked for swapping, history.replaceState, a gallery that follows the variant, /cart/add.js with sections, a static drawer section, /cart/change.js by line, a <dialog> with @starting-style.
  5. Search, pagination, metafields, translations and customers. /search/suggest rendering a section, search.types as chips, paginate.parts once, metafield_tag and a JSON metafield, locales/hi.json with every key, {% form 'localization' %}, the Markets setting that makes a language appear, new versus classic accounts.
  6. Performance, accessibility, Theme Check and publishing. Lighthouse through its node API in a logged-in Chrome, fetchpriority, sizes that match the layout, contrast and heading order, benchmarkIndex and what it says about the numbers, theme-check:all, the zip, the publish, the Theme Store.

The decisions

From scratch, not from Dawn. Dawn and Horizon are good themes and the usual advice is to start from one. The problem with starting from twenty thousand lines is that you learn the twenty thousand lines; the thing this series wants you to learn is the platform, and the fastest way to see what Shopify provides is to have nothing else in the folder. Every feature in Lantern exists because a part needed it, which also means the theme has no feature that nobody explains.

Tailwind, compiled once. The theme's stylesheet is Tailwind 4 compiled on the developer's machine into one 24 KB file that is committed, so the merchant's store never runs a build and the CLI never needs node. Theme settings become CSS variables in the layout and Tailwind's tokens read those variables, so a colour or font changed in the editor changes every utility that uses it. The src/ directory is in .shopifyignore and never reaches the store.

HTML from Shopify, not JSON. Part 4 sets the rule the rest of the JavaScript follows: when something on the page needs to change, fetch the section that renders it and replace the element. The variant picker fetches the product section with the new selection; add to cart asks the Cart API to return the drawer and the header already rendered. The theme never formats a price, never counts a cart and never holds a copy of a product in the browser, and the two hundred lines it does have are custom elements that enhance markup that works without them.

Every string through t, every URL through routes. From the first part, which is why the Hindi locale in part 5 was a file and a setting rather than a rewrite, and why Theme Check's full rule set passed the first time it ran.

Verified on the store, every part. Each part's screenshots are of the development store with the theme pushed, each command's output is the output it printed, and the final Lighthouse and Theme Check numbers are in part 6 with the machine's benchmark index next to them, because a performance score without its conditions is a guess.

Where it stands

Lantern 1.0.0 is the published theme on the development store and the zip is on the repository's release page. It is not in the Theme Store and is not trying to be: that needs presets, documentation, support and the testing only other people's stores provide. What it is, is a storefront a merchant could run and a developer could read in an afternoon, with the reasons for each piece one click away.

New posts by email

Get new posts by email. Nothing else, no digests, unsubscribe in one click.

Comments

Comments are GitHub Discussions in shipbytes/discussions. Sign in with GitHub to post.