FROM CACHE - en_header

Dynamically Name Section Blocks to differentiate many blocks

awhipp
Shopify Partner
7 0 9

Just like the image populates, my client would like the ability to have the name of a section block be dynamic so its easy to differentiate. See the image below.

In this image the client has many size charts that are linked to a product tag. She would like the tag to show up as text in the section block since the image is hard to make out and differentiate. I am unsure if this is possible. Does any one know of a way to override the section block name? I know it can be done by selecting a product as the first object but this does not help since a single size chart is assigned to 10-25 products based on a tag. I need the ability for the first line to be something that can replace "A Product Size Chart" with something identifiable.

Let me know if this needs clarification.

Thanks!

Venture Focused Consulting | E-Commerce Developer
Replies 13 (13)
Robert_Bugeag
Shopify Partner
13 0 0

Hello Alexander,

Did you find any solution for this?

 

Thank you

Helping store owners like you around the world. Check my youtube channel for how to videos: youtube.com/channel/UCdN-RKEorn61nZ3mTw4uq1g
awhipp
Shopify Partner
7 0 9

No not really. The closest was to add a text setting at the top and it will name the label, but then we lose the image.

Venture Focused Consulting | E-Commerce Developer
Robert_Bugeag
Shopify Partner
13 0 0

So you can change the name of the label "A product size..." from the theme settings? If so how do you do that?

Helping store owners like you around the world. Check my youtube channel for how to videos: youtube.com/channel/UCdN-RKEorn61nZ3mTw4uq1g
robskrob
New Member
2 0 3

The following schema allows me to create named blocks so all the blocks containing different content can be flagged by a unique name:

{% schema %}
  {
    "blocks": [
      {
        "type": "block-type",
        "name": "Block Name",
        "settings": [
          {
            "id": "image",
            "type": "image_picker",
            "label": "Image"
          },
          {
            "id": "title",
            "type": "text",
            "label": "Name"
          },
          {
          "id": "some_link",
          "type": "text",
          "label": "URL some page"
          }
        ]
      }
    ]
  }
{% endschema %}
DanWine
New Member
1 0 0

Hi all, is this a validated fix? We have the same issue but our agency are struggling to get the above workaround to work.

Cheers

btoone
Tourist
6 0 5

Just to clarify on @robskrob solution. The key part is to have an input's `id` assigned to be `title` in the settings array. As per instructions here https://shopify.dev/tutorials/develop-theme-use-sections#section-title

 

{
  "id": "title",
  ...
}
CastleRockTiger
New Member
2 0 1

For anyone looking in 2021 and beyond, this solution is no longer working. Shopify 2.0 has killed the dynamic naming of blocks using the "id": "title" method.

Matt_eman
Shopify Partner
61 3 5

We have noticed this as well, it seems the Online Store 2.0 docs still list it as a feature though here so we are hoping it is something that will get patched?

CastleRockTiger
New Member
2 0 1

The Shopify Dev team is aware of the bug and working to restore this functionality.

CMG_James
Tourist
13 0 2

Any update on this, my section title still does not update.

Matt_eman
Shopify Partner
61 3 5

It seems to be working for us, your section & block will re-name if you have a setting set to id: "title"

BigSkillet
Shopify Partner
19 0 18

Using id: "text" also works, although "title" seems more appropriate.

pinguluk
Tourist
8 0 2

I confirm that by adding a placeholder/setting with type text and by setting the id to title will set the block title as its value.