Describe the bug
Running shopify theme check on the official Horizon theme collection (unmodified) was expected to pass with no errors. Instead, 2 errors and 23 warnings were found.
The 2 errors appear to be a false positive in the UniqueStaticBlockId check because the duplicate id is intentional (I think) β the same static block is rendered with different variant parameters to produce desktop, mobile drawer, and navigation bar versions of the header menu from a single set of merchant-configurable settings.
Reproduced on:
Source
{% capture menu %}
{% content_for 'block', type: '_header-menu', id: 'header-menu' %}
{% endcapture %}
{% capture drawer_menu %}
{% content_for 'block', type: '_header-menu', id: 'header-menu', variant: 'mobile' %}
{% endcapture %}
{% capture navigation_bar %}
{% content_for 'block', type: '_header-menu', id: 'header-menu', variant: 'navigation_bar', transparent: transparent %}
{% endcapture %}
Expected behaviour
Running shopify theme check on unmodified official Horizon themes should pass with 0 errors. The UniqueStaticBlockId check should not flag duplicate static block ids when the calls are differentiated by the variant parameter, as the shared id is deliberate β it ensures the Theme Editor shows a single configurable block whose settings apply to all renderings.
Actual behaviour
Two errors are reported:
sections/header.liquid:55 - [error] UniqueStaticBlockId - The id 'header-menu' is already being used by another static block
sections/header.liquid:59 - [error] UniqueStaticBlockId - The id 'header-menu' is already being used by another static block
The theme functions correctly at runtime β the Liquid engine renders all three variants, and merchants see a single block in the Theme Editor as intended. The error is purely a linting false positive.
Debugging information
- OS: Linux (WSL2)
- OS Version: 6.6.87.2-microsoft-standard-WSL2
- Shopify CLI: 3.91.0
- Theme: Horizon collection β Dwell v3.4.0
Additional context
- The identical code and identical errors are present in the official Shopify/horizon repository.
- The
variant parameter is a documented feature of content_for 'block' that allows a single block definition to render different markup based on context.
- Giving each call a unique id (e.g.
header-menu-desktop, header-menu-mobile, header-menu-navbar) would "fix" the lint error but break the intended UX β merchants would see three separate blocks in the editor and have to configure menu settings three times.
- The check's own documentation states "Disabling this check isn't recommended", which makes the false positive particularly confusing for theme developers encountering it in Shopify's own themes.
Describe the bug
Running
shopify theme checkon the official Horizon theme collection (unmodified) was expected to pass with no errors. Instead, 2 errors and 23 warnings were found.The 2 errors appear to be a false positive in the
UniqueStaticBlockIdcheck because the duplicate id is intentional (I think) β the same static block is rendered with differentvariantparameters to produce desktop, mobile drawer, and navigation bar versions of the header menu from a single set of merchant-configurable settings.Reproduced on:
Source
{% capture menu %} {% content_for 'block', type: '_header-menu', id: 'header-menu' %} {% endcapture %} {% capture drawer_menu %} {% content_for 'block', type: '_header-menu', id: 'header-menu', variant: 'mobile' %} {% endcapture %} {% capture navigation_bar %} {% content_for 'block', type: '_header-menu', id: 'header-menu', variant: 'navigation_bar', transparent: transparent %} {% endcapture %}Expected behaviour
Running
shopify theme checkon unmodified official Horizon themes should pass with 0 errors. TheUniqueStaticBlockIdcheck should not flag duplicate static block ids when the calls are differentiated by thevariantparameter, as the shared id is deliberate β it ensures the Theme Editor shows a single configurable block whose settings apply to all renderings.Actual behaviour
Two errors are reported:
The theme functions correctly at runtime β the Liquid engine renders all three variants, and merchants see a single block in the Theme Editor as intended. The error is purely a linting false positive.
Debugging information
Additional context
variantparameter is a documented feature ofcontent_for 'block'that allows a single block definition to render different markup based on context.header-menu-desktop,header-menu-mobile,header-menu-navbar) would "fix" the lint error but break the intended UX β merchants would see three separate blocks in the editor and have to configure menu settings three times.