Theme code

Edit theme files in the code editor or your own editor, and reuse theme components.

Themes are Nunjucks templates with HTML, CSS, JavaScript and a settings schema. For editing without code, see Themes and the visual editor.

Code editor

Storefront → Code editor edits the files of a theme.

  • Highlighting for Nunjucks, HTML, CSS, JavaScript and JSON. JSON errors are marked on their line.
  • A template that doesn't compile is refused when you save, with the error.
  • ⌘S (Ctrl+S) saves. Drag the edge of the file list or preview to resize it.
  • Images, video and audio in assets/ open in a viewer. Each folder's upload button takes images, fonts, short video and audio clips and .glb models.
  • Uploading a theme ZIP first lists the files it will overwrite. Tabs with unsaved edits keep your edits.
  • Ask AI (when the platform has an AI provider) proposes a new version of the open file, checked like an uploaded file and shown as a diff. It goes into the editor only when you press Put in editor.

Built-in theme updates keep every file you edited. Imported themes are never rewritten by an update.

Email templates

Storefront → Email settings edits buyer email templates in the same editor. The Variables panel lists every field a template receives (shop, invoice, invoice item, product and variant, customer and more); click a field to copy it, or a loop to copy its for block. Pick a Sample product to preview with it. Send test sends the saved draft through your store's sender.

The order-completed template receives invoice.items[].deliverables, invoice.items[].files and invoice.items[].delivery_note.

Work on theme files outside the dashboard

Use the theme CLI to pull, push, watch and preview from your editor. To move files by hand:

  1. Download ZIP from the theme's ⋯ menu on Storefront → Themes.
  2. Edit the files in your own editor. Commit built CSS (for example Tailwind output) in assets/; nothing is built on upload.
  3. Upload it with Upload theme and Install as → Replace files in that theme. You see every changed file before anything is saved.

To automate this, use the storefront themes API with a key that has the storefront:write permission: list and read files, save a draft, preview and publish.

Coming from sellauth-theme

SellAuth's sellauth-theme CLI only talks to SellAuth. To move a theme you built with it, zip its folder (or pick the folder itself) and use Storefront → Themes → Upload theme.

Theme components

Developers → Theme components holds reusable pieces you can install into themes.

  1. Register a version (semantic versioning). Its properties are checked and its template compiled.
  2. Publish it. Published versions can't change.
  3. Install it on a theme. Installing another version takes a snapshot of the theme first, so going back to an older version is a rollback.

Theme components are shared by live and test mode.

Previews under load

Theme previews wait in a short queue during a burst. When the queue is full, the preview answers 429 with Retry-After and tries again.

On this page