Edit Code
Most stores never need code: the store builder has a large library of sections and blocks, and Fox can generate new ones. When you or your agency want something exactly your way, a theme can also hold its own code files, written in Liquid.
Custom sections made in code show up in the builder like built-in ones, with their own settings, so the store owner keeps editing them visually.
Agencies and developers usually work on these files from the repzo CLI with their own editor or AI tool. The Code view in the builder is for reading the files and making quick fixes. For the full language reference, see Theme Code.
Open the Code view
Section titled “Open the Code view”In the builder, click Code in the top bar. The URL gets ?tab=code, so you can share a link straight to it. When the theme code has errors, the Code button shows a red dot.
The left panel lists the theme’s files in three groups:
| Group | What it holds |
|---|---|
| Sections | Sections that show up in Add section, with the settings from their schema. |
| Blocks | Blocks that go inside your custom sections, or inside built-in sections that accept any block. |
| Snippets | Reusable pieces you render from sections and blocks. |
Editing code works best on a computer.
Add, rename, or delete a file
Section titled “Add, rename, or delete a file”- New file: click + next to a group, type a Name (lowercase letters, numbers,
-and_, for examplehero-banner), and click Create section (or block, or snippet). New sections and blocks start as a small working example with a heading and text you can change. - Rename: open the file’s ⋯ menu and choose Rename. Sections and blocks already placed on your pages follow the new name. Files that render a renamed snippet by name need updating by hand.
- Delete: open the ⋯ menu and choose Delete. If the section or block is used in the theme, those uses are removed too. You can undo this.
Edit a file
Section titled “Edit a file”The editor highlights Liquid and suggests the theme’s objects, filters, and tags as you type. Click Guide to open the theme code guide beside the editor.
The store checks your code as you type:
- Problems are underlined in place.
- The Problems list under the editor counts errors and warnings. Click one to jump to its line. With nothing wrong it says No problems.
- A file can be up to 48 KB, and a theme up to 60 files and 512 KB in all. Move parts into snippets when a file grows too big.
Edits go into the theme’s draft like any other change: they autosave, undo with Ctrl/⌘ + Z, appear in Version history, and go live when you publish.
Preview while you edit
Section titled “Preview while you edit”With enough room (a middle area of 960 px or wider), the live preview sits beside the editor. On smaller screens, switch between Editor and Preview at the top. The preview keeps updating while it’s hidden, and the editor keeps your cursor and undo history. You can also hide the file list and turn line wrapping on or off; both are remembered on your device.
Use your sections in the builder
Section titled “Use your sections in the builder”- In Add section, your code sections appear first under Custom, with a live thumbnail. Add them to any page like a built-in section.
- In Add block, blocks listed in the section’s schema appear the same way.
- The settings panel of a custom section or block has Edit code, which opens its file.
- While the Code view is open, clicking a custom section in the preview opens its file.
The store owner changes a custom section’s text, pictures, and options in the settings panel, without touching code.
A small example
Section titled “A small example”This is a complete section file. The {% schema %} at the bottom describes its settings, so the builder shows a Heading and Text field for it.
<section class="promo"> <div class="promo__inner"> {% if section.settings.heading != blank %} <h2>{{ section.settings.heading }}</h2> {% endif %} {% if section.settings.text != blank %} <p>{{ section.settings.text }}</p> {% endif %} {% content_for 'blocks' %} </div></section>
{% stylesheet %} .promo__inner { max-width: 72rem; margin: 0 auto; padding: 3rem 1.5rem; text-align: center; }{% endstylesheet %}
{% schema %}{ "name": "Promo", "settings": [ { "type": "text", "id": "heading", "label": "Heading", "default": "Promo" }, { "type": "textarea", "id": "text", "label": "Text" } ], "blocks": [{ "type": "@theme" }], "presets": [{ "name": "Promo" }]}{% endschema %}{% content_for 'blocks' %} draws the blocks the store owner adds inside the section, and "@theme" lets them add any of the builder’s blocks there (headings, buttons, product cards, and so on).
No JavaScript
Section titled “No JavaScript”Theme code can’t run JavaScript. <script> tags, onclick and other on… attributes, and javascript: links are errors. Code on a store page would run for signed-in shoppers next to their cart, orders, and addresses, and the same theme draws checkout and account pages.
Instead, add ready-made behaviours with data-sf-* attributes: tabs, accordion, slider, countdown, pop-up, show more, copy, reveal on scroll, lightbox, form messages, and the live cart. Pixels and chat widgets come from the store’s own integrations. See Theme Code for each behaviour.
Publishing with errors
Section titled “Publishing with errors”Warnings don’t stop you, but errors do. Publishing (now or scheduled) is refused while any code file has errors, with a Show errors button that opens the first one. A section whose file is broken simply draws nothing on the store.
The builder’s Store check also lists code errors, and its Go to button opens the file.
Permissions
Section titled “Permissions”You need commerce.manage to change code. Teammates who can only view Commerce see the files marked Read only.
Work from the CLI
Section titled “Work from the CLI”Agencies usually pull the theme to a folder, edit it with their own tools, and push it back:
repzo store pull SITE_ID --dir my-storerepzo store dev --dir my-storerepzo store push --dir my-store --yesrepzo store pull also writes an AGENTS.md guide so AI tools can write correct sections. See Build a Store from the CLI.