What is the suggested way to store unique configuration of a template under section architecture?

sillycube
Shopify Partner
694 16 101

From Static and dynamic sections, it states that:

A section can be included in multiple templates, but there exists only one instance of that section. When a merchant changes the configuration of a static section in one place, that change will apply to all other places where the section is included. Note that sections cannot include other sections.

If I want to store the unique configuration of a template, what is the best practice? Using metafields to store it? I want the configuration to only change 1 template instead of multiple templates to be changed at once

 

BYOB - Build Your Own Bundles, SPO - SEO App to research keywords & edit social link preview
Replies 3 (3)
StevenPM
Shopify Partner
76 7 7

You would likely be best to duplicate the section to make it unique, kinda like you would with a smart object in Photoshop. That way you have full unique configuration.

This theme developer has an example of the process: https://help.outofthesandbox.com/hc/en-us/articles/360034124294-Flex-Guide-Duplicating-Product-Secti...

Let me know if that solution works for you.

Steven

sillycube
Shopify Partner
694 16 101

If the section template is updated, I've to update all of them with the new template?

BYOB - Build Your Own Bundles, SPO - SEO App to research keywords & edit social link preview
StevenPM
Shopify Partner
76 7 7

Yes, you would update all templates that use different sections. The only exception to this is the homepage, as it was always built to be the only truely dynamic section page.

If you plan to make a non-homepage template mostly static however, you would then want to consider making the sections for the templates 'modular' so as to be able to build it from the same modular code. For example, build your sections from snippets. That way you don't have as much work to do when creating new templates this way.

Most importantly, if you want most of your templates to use the same saved configuration data, that goes against what sections are designed to be used for. So you would need to plan accordingly, as there are pros and cons to either making templates truely static or dynamic.

I appreciate this is just a simple explaination, but it is a very large subject.

Steven