0
votes

I'm developing a Shopify theme, and I notice that most themes include pre-constructed sections on the home page when you install it on your store. The Debut theme is a perfect example of this.

I know you can write Presets when you make your section, which gives it starting data, but that seems to only show up when you ADD THE SECTION as opposed to installing the theme. I want a certain number of sample sections to be visible out of the box.

2

2 Answers

0
votes

Found out how to do it, you need to custom-add the sections, blocks, etc to the schema_data.json in the sections portion you need to add the filename of the section you want to have shown on the home page. Then during a fresh theme install it will be there.

0
votes

The correct way is to use the {% schema %} tag. See how the example is using "presets" Depending on whether the section is statically included or dynamically included on the index you should use "preset" or "default" you can read more about that here

{% schema %}
  {
    "presets": [
      {
        "category": "Custom Content",
        "name": "Text",
        "settings": {
          "heading": "Hello World"
        },
        "blocks": [
          {
            "type": "text",
            "settings": {
              "content": "Once upon a time..."
            }
          }
        ]
      }
    ]
  }
{% endschema %}