We’ve been reading up on App Sections and it seems like the new experience will be a great improvement for merchants over manually pasting in code.
One thing that wasn’t clear, though, is how we’re expected to surface merchant-specific data in the settings for these sections.
For example, imagine a calendar app that allows merchants to show upcoming events. A merchant with two physical locations might set up two calendars in the app - “New York events” and “Miami events”.
Ideally, the merchant could then go to a page in the Shopify theme editor, add a new “Calendar app” section, then choose from a dropdown menu which calendar to show (New York or Miami). In this case, the dropdown that appears in the editor would need to be populated based on a shop-specific settings blob that is made available by the app somehow.
However, the documentation for App Sections seems to indicate that the section (including settings options) is defined by a single static Liquid file that is uploaded by the developer, and which applies identically across all shops using the app. Is this really the case? If so, it seems like this is fairly restrictive in terms of integration with individual shop data.
I could also imagine a different approach where the app dynamically adds/updates sections via the Asset API. In this case the shop might end up with two separate sections available - “Calendar app: New York” and “Calendar app: Miami”, although they wouldn't technically be "App Sections", but regular theme sections created by the app. This seems like it might work, although it’s not clear if sections added to a theme this way can easily be re-used when switching themes.
Could anyone shed some light on what the expected workflow is for this sort of situation?
Thanks for getting in touch and describing your potential use-case around how apps could work with merchant-specific content. I've communicated this example and suggestions on to our internal developer team, and we’ll work on finding a solution to this. I'll update here when our developer team has explored this further.
Just to note on your potential approach that apps could dynamically add/update sections via the Asset API- this is something we would not encourage as it could have unpredictable effects on the theme, and as you noted there could be issues around portability.