Migrate static sections to section groups
Section groups give merchants the flexibility to add, remove, and reorder sections in their theme's layout without making changes to the theme code.
If you created your theme before section groups became available, then you might render one or more sections statically in your layout file. Because section groups are more flexible and reduce the need for code changes, you should replace the statically rendered sections in your layout files with section groups that contain the sections by default.
When you migrate static sections to section groups, Shopify attempts to migrate any applicable settings for the merchant during the theme update process.
Step 1: Create new section groupsAnchor link to section titled "Step 1: Create new section groups"
Create a section group for each of the areas of your layout where you include static sections. In most cases, you need to create a header section group and a footer section group.
sectionsdirectory, create a new JSON file for the section group.
The file name should identify the area of the layout that the section group represents. For example, you might create a file called
header-group.jsonfor your header section group.
In the file, add data for the basic section group schema, including the section group type and name.
Add references to the sections that you want to include in the section group. You should include all of the static sections that the section group is replacing, so Shopify can copy a merchant's static section settings to the section group.
For example, the header area of your layout file might contain the following sections:
You can add references to those sections in your new section group:
Step 2: Replace static section tags with section group tagsAnchor link to section titled "Step 2: Replace static section tags with section group tags"
After you create your section group JSON file, replace the static sections in your layout file with your new section group:
Settings migration for theme updatesAnchor link to section titled "Settings migration for theme updates"
When a merchant updates their theme from a version that uses a static section to a version that includes that section in a section group, Shopify attempts to copy the static section's settings to the settings for the equivalent section in the section group. Shopify maps these settings based on the section's
For example, if a theme uses a section group that has a section of type
header, Shopify copies any settings for a section of type
header from the old version’s