How to create a global section

Hi Shopify community,

I’m using the official Shopify theme Dawn. I created a section that should be added and configured dynamically in more templates by the user in the Shopify theme editor. How can I make it available globally such like these ones:

Hey @luigi-ib :slightly_smiling_face:

thank you for posting that Problem and im glad to help you :slightly_smiling_face:
Can you post your code in here so i can look at it?

Hi @BosiDev

the code the section is the following:


  

    ## {{ "sections.settings.title" }}
  

  

{% schema %}
{
  "name": "Gallery carousel",
  "tag": "section",
  "class": "spaced-section",
  "settings": [
    {
      "type": "text",
      "id": "title",
      "label": "Carousel title"
    }
  ]
}
{% endschema %}

I would create a theme where this section is globally available so the merchant can add it in any page he wishes from Shopify theme editor. Like these ones:

Hi @luigi-ib

You need to add preset settings in the schema so it will show in the list of sections in Theme Editor. Here’s how the section code will look like:


  

    ## {{ "sections.settings.title" }}
  

  

{% schema %}
{
  "name": "Gallery carousel",
  "tag": "section",
  "class": "spaced-section",
  "settings": [
    {
      "type": "text",
      "id": "title",
      "label": "Carousel title"
    }
  ],
  "presets": [
    {
      "name": "Gallery carousel"
    }
  ]
}
{% endschema %}

@juanvisbal come on, let me help that guy :joy: Yes indeed, just add the presets and it will work smoothly :slightly_smiling_face:

It works as expected. Thank you for the help!