Skip to content

Creating a New Theme Section

Creating a New Theme Section

Sections are the building blocks of your storefront pages. You can create custom sections from scratch in the code editor and they will appear in the Visual Editor's + Add panel — ready to drag onto any page.

What is a section?

A section is a Liquid template file in the sections/ folder. It contains:

  • HTML markup — the structure rendered on your storefront.
  • Liquid logic — dynamic content from products, settings, or your shop.
  • Schema block — a JSON block at the bottom of the file that defines the settings merchants can configure in the Visual Editor sidebar.

Creating a new section

  1. Open the code editor (Online Store → Themes → Edit Code).
  2. Click the + icon in the file tree header.
  3. In the modal, select Section as the file type.
  4. Enter a name (e.g., my-banner). Cartly will create sections/my-banner.liquid.
  5. Click Create.

Cartly generates a working scaffold automatically — full HTML structure, five example settings (a heading text field, color picker, range slider, checkbox, and image picker), and a preset with default values. You can edit the scaffold immediately.

Understanding the schema block

The {%- schema -%} block at the bottom of the file controls what appears in the Visual Editor sidebar when a merchant selects this section. Key fields:

  • name — the display name shown in the + Add panel (e.g., "Feature Grid").
  • settings — an array of configurable fields. Each field has a type, an id (used in Liquid as section.settings.id), a label, and optionally a default value.
  • presets — an array of preset configurations. At least one preset is required. Without a preset, the section does not appear in the + Add panel.

Why presets matter

When a merchant clicks + Add section in the Visual Editor, they see a list of sections with their preset configurations. The preset provides a ready-to-use starting point — default text, default colors, and a default set of blocks. Without a preset, your section is invisible to the Visual Editor. Always include at least one.

Available setting types

TypeWhat it shows in the editor
textSingle-line text input
textareaMulti-line text area
image_pickerMedia library selector
colorColor picker
rangeSlider with min, max, and step
selectDropdown — requires an options array
checkboxOn/off toggle
urlURL input
productProduct search typeahead
collectionCollection search typeahead

After saving

Save the file with ⌘S (Mac) or Ctrl+S (Windows). Open the Visual Editor (Online Store → Themes → Customize) and click + Add section — your new section appears in the list, ready to add to any page.

Was this helpful?