Skip to main content

JSONMissingSection

Ensures that every section type referenced by a JSON template (templates/*.json) or a section group (sections/*.json) refers to a section file that exists in the theme's sections directory.

Each entry in the top-level sections object of these files has a type property. That type must resolve to a sections/<type>.liquid file in the theme. Shopify runs the same validation when a theme is uploaded or published, so this check surfaces the problem while you're developing the theme.

The following section types are exempt from this check, because Shopify provides default files for them:

  • apps
  • _blocks

Section entries that don't have a type property are skipped. The type property at the top level of a section group file, such as header or footer, isn't a section reference, so it isn't checked.


The following examples contain code snippets that either fail or pass this check.

In the following example, the JSON template file references a section type that doesn't exist. There's no corresponding featured-collection.liquid file in the sections directory for the theme:

templates/index.json

{
"sections": {
"featured-collection": {
"type": "featured-collection"
}
},
"order": ["featured-collection"]
}

In the following example, the section group file references a section type that doesn't exist. There's no corresponding announcement-bar.liquid file in the sections directory for the theme:

sections/header-group.json

{
"type": "header",
"name": "Header group",
"sections": {
"announcement-bar": {
"type": "announcement-bar"
}
},
"order": ["announcement-bar"]
}

In the following example, the JSON template file references a section type that exists in the sections directory for the theme:

templates/index.json

{
"sections": {
"featured-collection": {
"type": "featured-collection"
}
},
"order": ["featured-collection"]
}

sections/featured-collection.liquid

{% schema %}
{
"name": "Featured collection"
}
{% endschema %}

The following example contains the default configuration for this check:

JSONMissingSection:
enabled: true
severity: error
ParameterDescription
enabledWhether this check is enabled.
severityThe severity of the check.

Anchor to Disabling this checkDisabling this check

Disabling this check isn't recommended. A theme that references a section file that doesn't exist is rejected when it's uploaded or published.


Was this page helpful?