Shopify / Shopify/liquid

Render section with blocks use Section Rendering API.

Open
#1,496 5 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
11.9k
Forks
1.5k
Avg merge
17h 55m
Merged PRs (30d)
3

Description

Hi
I use the Section Rendering API to render the content of a section but the problem is that it cannot render the blocks that the section owns.

Example:

<div class="section-blocks">
	{%- for block in section.blocks -%}
		{%- case block.type -%}
			{%- when 'title' -%}
				<span>This is title</span>
			{%- when 'text' -%}
				<span>This is text</span>
		{%- endcase -%}
	{%- endfor -%}
</div>

{% schema %}
{
	"name": "Demo section",
	"tag": "section",
	"class": "demo-section",
	"settings": [],
	"blocks": [
		{
			"type": "title",
			"name": "the_title",
			"settings": []
		},
		{
			"type": "text",
			"name": "the_text",
			"settings": []
		}
	]
}
{% endschema %}

Normally, it will display the following content.

<div class="section-blocks">
	<span>This is title</span>
	<span>This is text</span>
</div>

But when using Section Rendering API, the content is only:

<div class="section-blocks"></div>

Section Rendering API does not support rendering blocks?
Or did I miss a document or tutorial?

Can someone explain it to me, thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Section Rendering API scenario using the Liquid section and block example in the issue. Compare the normal render with the API response, then establish whether block rendering is supported and what behavior or documentation would define the issue as resolved.

Written by the indexing model from the issue text.

Assessment

Domain
api
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.