What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Could not find selected block, please make sure your theme is using {{ block.shopify_attributes }}

Could not find selected block, please make sure your theme is using {{ block.shopify_attributes }}

Rostislav333
Shopify Partner
10 0 0

In the Customizer, the console displays the following message: Could not find selected block, please make sure your theme is using {{ block.shopify_attributes }}. When should you use {{ block.shopify_attributes }}? Every time there is a for blocks loop?

I have a snippet: 
render 'header-dropdown-menu', mega_menu: mega_menu

{% comment %}
  Accepts:
    - mega_menu: {Boolean} Enable mega menu. Default: false


    Usage:
    {% render 'header-dropdown-menu', mega_menu: false %}
{% endcomment %}

<nav class="header__menu">
  <ul class="header__menu-list">
    {%- for link in section.settings.menu.links -%}
      <li>
        {%- if link.links != blank -%}
          <details
            level="top"
            {%- if mega_menu -%}
              is="details-mega"
            {%- else -%}
              is="details-dropdown"
            {%- endif -%}
          >
            <summary data-link="{{ link.url }}">
              <span class="menu__item">
                <span class="font-heading underline-hover">
                  {{- link.title | escape -}}
                  {% render 'icon-caret' %}
                </span>
              </span>
            </summary>
            <div class="dropdown">
              <div class="dropdown__container">
                <ul class="dropdown__nav" role="list">
                  {%- for childlink in link.links -%}
                    <li>
                      {%- if childlink.links == blank -%}
                        <p>
                          <a class="underline-hover" href="{{ childlink.url }}">{{ childlink.title | escape }}</a>
                        </p>
                      {%- else -%}
                        <details level="child" is="details-dropdown">
                          <summary data-link="{{ childlink.url }}">
                            <a class="underline-hover" href="{{ childlink.url }}">{{ childlink.title | escape }}</a>
                            {% render 'icon-caret' %}
                          </summary>
                          <div class="dropdown">
                            <div class="dropdown__container">
                              <ul class="dropdown__nav" role="list">
                                {%- for grandchildlink in childlink.links -%}
                                  <li>
                                    <p>
                                      <a class="underline-hover" href="{{ grandchildlink.url }}">
                                        {{- grandchildlink.title | escape -}}
                                      </a>
                                    </p>
                                  </li>
                                {%- endfor -%}
                              </ul>
                            </div>
                          </div>
                        </details>
                      {%- endif -%}
                    </li>
                  {%- endfor -%}
                </ul>
              </div>
            </div>
          </details>
        {%- else -%}
          <a
            href="{{ link.url }}"
            class="menu__item font-heading"
            title="{{- link.title | escape -}}"
          >
            <span class="underline-hover">{{- link.title | escape -}}</span>
          </a>
        {%- endif -%}
      </li>
    {%- endfor -%}
  </ul>
</nav>

 

Where in my snippet can I use {{ block.shopify_attributes }}?


Reply 1 (1)

Liam
Community Manager
3108 344 895

Hi Rostislav333

 

For a block to be available in the preview inspector, it requires {{ block.shopify_attributes }} to be added to the wrapping element. 

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog