How to Build a Custom Section in Shopify (2026)

Last updated
•
Expert reviewed
•
5 min read

Key takeaways

  • Shopify sections are Liquid files in the sections/ folder with a {% schema %} block defining their settings.
  • Settings defined in the schema automatically appear in the Theme Editor right panel.
  • Add a presets key to the schema to make the section available in “Add section” without manual template editing.
  • Fudge generates complete custom sections from a plain English description — including HTML, CSS, JavaScript, and schema.

Every section in the Theme Editor is a Liquid file with a schema. The schema is what makes it editable without code — it defines which settings appear in the right-hand panel, what type of input each setting is, and what the default values are.

How to create a custom section in Shopify

Step 1 - Duplicate your active theme. Online Store → Themes → three-dot menu → Duplicate.

Step 2 - Open the code editor on the duplicate theme.

Step 3 - Navigate to the sections/ folder.

Step 4 - Click the ”+” or “Add a new section” button. Name your section (e.g., custom-promo-banner). Shopify creates sections/custom-promo-banner.liquid.

Step 5 - Write your section content and schema.


The anatomy of a Shopify section

A section file has two main parts: HTML/Liquid content and a {% schema %} block.

<!-- The visible content -->
<div class="promo-banner" style="background-color: {{ section.settings.background_color }};">
  <div class="page-width">
    <p class="promo-banner__text">{{ section.settings.text }}</p>
    <a href="{{ section.settings.button_link }}" class="button">
      {{ section.settings.button_label }}
    </a>
  </div>
</div>

{% schema %}
{
  "name": "Promo Banner",
  "settings": [
    {
      "type": "text",
      "id": "text",
      "label": "Banner text",
      "default": "Free shipping on orders over $50"
    },
    {
      "type": "color",
      "id": "background_color",
      "label": "Background color",
      "default": "#000000"
    },
    {
      "type": "text",
      "id": "button_label",
      "label": "Button label",
      "default": "Shop Now"
    },
    {
      "type": "url",
      "id": "button_link",
      "label": "Button link"
    }
  ],
  "presets": [
    {
      "name": "Promo Banner"
    }
  ]
}
{% endschema %}

How schema settings work:

  • "type" — the input type (text, color, url, image_picker, select, range, etc.)
  • "id" — the variable name used in Liquid: {{ section.settings.text }}
  • "label" — what appears in the Theme Editor
  • "default" — the initial value when first added

For a longer walkthrough, see how to add a new section type in Shopify.


Common schema setting types

TypeUse for
textShort text inputs
textareaLonger text
richtextFormatted text with bold/italic
image_pickerLet merchants pick an image
urlLinks and button destinations
colorColor picker
rangeNumber slider (e.g., padding, font size)
selectDropdown with predefined options
checkboxBoolean toggle
htmlCustom HTML input
headerGroup label (not a real setting, just visual)

Adding blocks — repeating elements

Blocks let merchants add repeating content — testimonials, FAQs, feature items. Each block has its own schema.

{% for block in section.blocks %}
  <div class="testimonial" {{ block.shopify_attributes }}>
    <p>{{ block.settings.quote }}</p>
    <cite>{{ block.settings.author }}</cite>
  </div>
{% endfor %}

In the schema, add a "blocks" key:

"blocks": [
  {
    "type": "testimonial",
    "name": "Testimonial",
    "settings": [
      {
        "type": "textarea",
        "id": "quote",
        "label": "Quote"
      },
      {
        "type": "text",
        "id": "author",
        "label": "Author name"
      }
    ]
  }
],
"max_blocks": 6

{{ block.shopify_attributes }} is required for the Theme Editor to recognize each block and allow editing.


Making your section appear in “Add section”

The "presets" key in the schema is what makes your section appear in the Theme Editor’s “Add section” menu. Without presets, the section only works if manually added to a template JSON file.

A preset can also add starting blocks. For the testimonials section from the blocks example above, this preset adds one testimonial when the section is added:

"presets": [
  {
    "name": "Testimonials",
    "blocks": [
      {
        "type": "testimonial"
      }
    ]
  }
]

The "name" in presets is the label that appears in the “Add section” menu.

Build a custom Shopify section by describing it to Fudge.
Start free trial

For more on blocks, see how to add blocks to a Shopify section.


Adding CSS and JavaScript to a section

Use {% stylesheet %} and {% javascript %} blocks at the bottom of the section file (after the schema):

{% stylesheet %}
  .promo-banner {
    padding: 12px 0;
    text-align: center;
  }

  .promo-banner__text {
    font-size: 14px;
    margin: 0 0 8px;
  }
{% endstylesheet %}

{% javascript %}
  // Section-specific JavaScript here
  // Automatically bundled and deferred by Shopify
{% endjavascript %}

Shopify bundles all section stylesheets and scripts automatically — you don’t need to create separate CSS or JS files for simple sections.


Using Fudge to generate custom sections

Building sections manually requires understanding Liquid, JSON schema syntax, and Shopify’s section architecture. Fudge, the AI operator for Shopify stores, removes that barrier. Describe the section in its store editor:

“Build a testimonials section with a heading, subtitle, and up to 6 testimonial blocks. Each block should have a quote (text area), author name, author title, and star rating (1-5 range). Show them in a 3-column grid on desktop, 1 column on mobile.”

Fudge generates the complete section file — HTML, schema, CSS, and JavaScript — as a draft for review. It reads your theme first, so the section uses your fonts, colors and spacing, and it keeps working if you ever uninstall Fudge.


FAQ

What's the difference between a section and a snippet in Shopify?

A section is a self-contained block of content with its own schema, settings, and content - it appears in the Theme Editor as something the merchant can add and configure. A snippet is reusable Liquid code rendered via {% render 'snippet-name' %} - it has no schema and isn't merchant-editable. Use sections for merchant-configurable layouts; snippets for code reuse inside sections.

Why doesn't my new section appear in the Add section menu?

The schema is missing a presets array. A section is technically valid without presets but Shopify won't list it in the "Add section" dropdown. Add at least one entry: "presets": [{"name": "My Section"}] and it'll appear. (If you'd rather skip writing schema by hand, Fudge generates the section file — schema, presets, blocks, and Liquid — from a plain English description.)

Can I make a section that only works on certain page types?

Yes - in the schema add "enabled_on": { "templates": ["product"] } to allow only on product templates, or "disabled_on": { "templates": ["index"] } to hide it from the homepage. Useful for product-specific sections that don't make sense elsewhere.

Will my custom section break when I update the theme?

No, but it won't carry over by itself. When you update a theme from the Theme Store, Shopify installs a fresh copy and keeps theme editor settings, not code edits, so you must copy custom section files into the new version. Test in a duplicate theme first.

Can I use external libraries inside a section?

Yes - load them via <script src="..."> in the section HTML or in theme.liquid. The {% javascript %} block in a section can't import external scripts directly, only inline JS. For libraries used by multiple sections, loading once in theme.liquid is more efficient than loading per section.

Jacques's signature
Build custom Shopify sections by describing exactly what you need.

You might also be interested in

Jacques Blom
Jacques Blom
CTO at Fudge.