13

With the release of the new theme editor I've been assigned to build a new client's website using Shopify's new theme builder framework.

Everything has been going fine except that when I go to create a new 'Section' in the backend it fails to appear within the Theme Editor's 'Sections' area.

Any idea what's going wrong here? Is there another JSON file that is associated with sections that I'm missing?

<div id="callToActions">
  <div class="grid grid--no-gutters">
    <div class=""></div>
  </div>
</div>



{% schema %}
{
  "name": "Call to Actions",
  "class": "index-section index-section--flush",
  "settings": [
    {
      "id": "cta_1_title",
      "type": "text",
        "label": "CTA 1 Title",
      "default": "Dryups Specials"
    }
  ]
}
{% endschema %}
Naadei Atafu
  • 133
  • 1
  • 1
  • 4

1 Answers1

49

You're almost there, just missing one thing. Sections will only show up as options to be added if they have a preset defined.

This update will make it show up:

{% schema %}
{
  "name": "Call to Actions",
  "class": "index-section index-section--flush",
  "settings": [
    {
      "id": "cta_1_title",
      "type": "text",
      "label": "CTA 1 Title",
      "default": "Dryups Specials"
    }
  ],
  "presets": [{
    "name": "Call to Actions",
    "category": "Text"
  }]
}
{% endschema %}

Note the category. If omitted, it'll end up under Miscellaneous.

Carson
  • 4,541
  • 9
  • 39
  • 45
  • 8
    I wish Shopify docs had a note about this. Like a warning or something that is easy to notice. Have been developing a theme the last couple of weeks and I can't believe how often this kind of important notes are just missing from their docs. – Erick A. Montañez Mar 10 '19 at 06:20
  • 1
    I added the presets but my sections are still not showing up in my custom page. – Willower Apr 10 '19 at 21:45
  • 1
    Presets are only for showing the section in the home page "Add section" list. For a custom page (or any other template) you need to include it as a custom section: `{% section 'your-section' %}` – Carson Apr 11 '19 at 22:20
  • 4
    Still relevant in 2021 (with OS 2.0) and still no mention of it anywhere other than in the presets section of section schema article. As if we're expected to know that from college or ancestors – mzrnsh Oct 09 '21 at 10:42
  • This is not present in the documentation on sections anywhere, https://shopify.dev/themes/architecture/sections Cool to see some Shopify Development discussion on Stack instead of the Sopify forum. – Greggory Wiley Oct 28 '21 at 19:35
  • this is a shame on Shopify docs – seedme Jan 11 '23 at 05:04