Thats not a bad work around. Thanks for sharing.
I’ve been doing the same thing - using static blocks inside a forloop. That works just fine - but I run into issues if I want to combine static with dynamic blocks.
I prefer being able to support both approaches so that merchants can rely on metaobjects/metafields where needed, and alternatively just manually add/rearrange blocks when they prefer that. But supporting both experiences at the same time gets a bit messy in the theme editor and I don’t love that.
Mainly am trying to avoid forcing clients to have to use metaobjects, and enable them to input data directly into the theme editor whenever possible, to make management as easy and intuitive as possible.
AND the most massive issue right now is that because our agency has our own base theme that we use for all projects, if and when I have a metaobject setting in the schema, then any other stores using our theme must have that metaobject existing on the site, otherwise we run into obvious issues such as templates not uploading due to missing metaobjects, etc.
What I don’t want to have to do is assume the presence of any metaobjects. The original section block setup allowed for that which was so much more convenient. Then we could just create metaobjects as needed that could be mapped to section block settings.
The current approach works technically, but is a confusing theme editor experience and assumes metaobject presence on the store (note the “Metaobject Questions” static block and the normal “Question & Answer” dynamic blocks in the screenshots).
Here’s a code example of what I’m doing:
{% comment %}
Initial Liquid Variables
{% endcomment %}
{%- liquid
assign data = section.settings
assign question_metaobjects = data.questions
-%}
{% if question_metaobjects != blank or section.blocks != blank %}
{% comment %}
Section Markup
{% endcomment %}
<section class="s-q-a container">
<div class="s-q-a__main">
{% comment %}
Q&A Content
{% endcomment %}
<div class="c-accordion">
<ul class="c-accordion__list">
{% comment %}
Metaobject Q&A
{% endcomment %}
{% if question_metaobjects != blank %}
{% for entry in question_metaobjects %}
{% content_for 'block', type: '_question-and-answer', id: 'question-answer', closest.metaobject.fm_question_and_answer: entry %}
{% endfor %}
{% endif %}
{% comment %}
General Q&A
{% endcomment %}
{% content_for 'blocks' %}
</ul>
</div>
</div>
</section>
{% endif %}
{% comment %}
Section Schema
{% endcomment %}
{% schema %}
{
“name”: “Questions and Answers”,
“settings”: [
{
“type”: “header”,
“content”: “General Settings”
},
{
“type”: “metaobject_list”,
“id”: “questions”,
“label”: “Questions”,
“metaobject_type”: “fm_question_and_answer”,
“info”: “Select a dynamic metafield source or choose metaobject entries. Added entries appear before blocks. Most commonly, a dynamic metafield source is used.”
}
],
“blocks”: [{ “type”: “_question-and-answer” }],
“disabled_on”: {
“groups”: [“header”, “footer”, “aside”]
}
}
{% endschema %}
Create a [metaobject \"Font\"](/admin/settings/custom_data/metaobjects/create) with a json field (name \"Font json\"). The json format should be like a regular [font object](https://shopify.dev/docs/api/liquid/objects/font) but with the addition of file_name
I use the following signature as a note, with a reference to the quick creation of a new metaobject

