How to implement conditional sections in 2.0 themes?

Topic summary

Core Issue:
Developers are struggling to implement conditional sections in Shopify 2.0 themes, which was straightforward in 1.0 using Liquid logic to render different sections based on conditions (e.g., product type or customer tags).

Technical Challenge:
Since 2.0 templates are JSON files rather than Liquid files, the previous approach of wrapping {% section %} tags in conditional statements no longer works directly.

Proposed Solutions:

  • Move conditional logic inside the section itself, so sections always load but may not display content
  • Use Ajax/Section Rendering API to dynamically load sections based on conditions
  • Create duplicate section files with identical settings, each including a snippet that handles the rendering logic, then add both sections to the template

Current Status:
The original poster implemented the last approach: moving section code into snippets, creating two sections with different conditional logic for including those snippets, and adding both sections to the template. This workaround functions but isn’t ideal due to duplicated section settings and both sections being present in the template.

Summarized with AI on November 9. AI used: claude-sonnet-4-5-20250929.

I haven’t implemented anything yet, but the only solution I can currently think of is always including the Section, but having the logic of wherever it displays or not inside the section code. So the section will always be included, but may not neccessarily display.

My alternative approach for smaller sections within the header/footer will be to have them as static sections in the Template, but to actually load them via Ajax as seen here: https://shopify.dev/api/section-rendering . Will be a good technique for smaller secitons needed in multiple areas, e.g. a Store Switcher (drop down of international stores to choose from).