Start building

Tips

Shopify dynamic sources: why the connect icon is missing, and how to fix it

You've made a metafield and opened the theme editor, and the setting has no connect icon, or the icon is there but your metafield isn't listed. Nearly always, one of six things is the reason.

The Klorr teamUpdated 8 min read

  • Metafields
  • Theme editor
  • Schema

Key takeaways

  • A dynamic source fills a section or block setting from a resource's attribute or metafield, without any Liquid for that value.
  • The setting's type decides what it can accept. A number metafield can't connect to a number or range setting, but it can connect to text.
  • A source also needs a resource in context: the product template, a collection setting on the section, or a product setting on a block.
  • Product and collection sources aren't available in general theme settings, and each template or section group is limited to 100 sources.

Six reasons a source isn't offered

1. The setting's type doesn't take sources

This one's easy to miss when building a section. Only certain types can connect at all, listed in the table further down. checkbox, select, radio, range, number, font_picker and link_list aren't on it. So a "Discount percent" field built as a range will never pull from a metafield, while the same field built as text can. The fix is in the schema, and the merchant can't do anything about it from the editor.

2. Your metafield's type doesn't match the setting

If the icon's there but your metafield isn't in the list, compare types. A url setting takes only a URL metafield, so a metafield of type link doesn't appear for it, even though it holds a link. The text setting doesn't take rich text or link types, and image_picker needs a file metafield. Change the setting type, or for rich content use richtext, which takes the widest range.

3. There's no resource on this page to read from

Sources need something to read. Per Shopify's docs, the common cases are:

  • The section sits on a product template: that product's attributes and metafields are available to the section's settings and its blocks.
  • The section has a `collection` type setting: that collection's data is available to the section and its blocks.
  • A block has a `product` type setting: that product's data is available to that block's other settings.

Metaobjects with storefront visibility are available more widely. That's why a section on your home page often offers nothing related to a product. To feature one there, give each block a product setting. The block's other settings can then connect to that product's data.

4. The metafield isn't set up to be seen

Metaobjects need storefront visibility turned on to show up as sources. For metafields, look in Settings › Custom data: the editor's list is built from metafield definitions. A value that was written by an app or the API with no definition behind it may not appear, so check that one exists and has the type you expect. The editor's search lets you add up to 20 metafields in one template from the + option, which helps when the first list is short.

5. You're in theme settings

Shopify's docs say dynamic sources aren't available for general theme settings, so product and collection data won't be offered under the theme settings cog. The one exception they list is storefront-visible metaobjects, available to any theme setting, which is presumably why the limits table below has a row for theme settings.

6. You've hit a limit

WhereMaximum dynamic sources
A JSON template100
General theme settings100
A section group100
A static section50
A single setting50

A busy product template with many connected text blocks can reach this. The usual way out is grouping values: one metaobject reference, or a section written to read several metafields in Liquid.

What connects to what

This is Shopify's compatibility table, and it answers most questions on the topic. When you're writing a schema, find the metafield type you need in the right-hand column, then use the setting type beside it.

Setting typeMetafield types it accepts
textSingle-line text, list of single-line text, integer, decimal, date, date and time, weight, volume, dimension, rating, money
inline_richtextThe same as text, plus link
richtextText, list of text, multi-line text, rich text, integer, decimal, date, date and time, weight, volume, dimension, rating, money, link
urlURL
colorColor
image_pickerFile reference
videoFile reference, accepting video files
productProduct reference
product_listList of product references
collectionCollection reference
collection_listList of collection references
pagePage reference
articleArticle reference
metaobjectMetaobject reference of the setting's type
metaobject_listList of metaobject references of the setting's type

Besides metafields, settings can connect to a resource's own attributes:

ResourceAttributes available
ProductTitle, vendor, description, URL, featured image, collections
CollectionTitle, image, description, URL, products
PageTitle, URL, content
ArticleTitle, URL, author, content, excerpt, comments count, image
BlogTitle, URL

A section built to connect

Your Liquid doesn't change to support sources. It reads section.settings.subtitle whether the merchant typed the text or connected a metafield. You make it source-friendly by choosing the right setting types, and by handling empties, since one product may fill a metafield that another leaves blank.

sections/product-callout.liquid
{%- assign sid = 'callout-' | append: section.id -%}

{% style %}
  #{{ sid }} { display: grid; gap: 24px; max-width: 1100px; margin: 0 auto; padding: 40px 16px; color: {{ section.settings.text_color }}; }
  @media (min-width: 750px) { #{{ sid }}.has-image { grid-template-columns: 1fr 1fr; align-items: center; } }
  #{{ sid }} img { display: block; width: 100%; height: auto; border-radius: 10px; }
  #{{ sid }} h2 { margin: 0 0 12px; color: inherit; }
  #{{ sid }} .callout__eyebrow { margin: 0 0 6px; font-size: 13px; }
  #{{ sid }} .callout__link { display: inline-block; margin-top: 16px; color: inherit; }
  #{{ sid }} .callout__link:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
{% endstyle %}

{%- if section.settings.heading != blank or section.settings.body != blank or request.design_mode -%}
  <div id="{{ sid }}" class="{% if section.settings.image != blank %}has-image{% endif %}">
    {%- if section.settings.image != blank -%}
      {{ section.settings.image | image_url: width: 1100 | image_tag: loading: 'lazy', widths: '400, 600, 800, 1100', sizes: '(min-width: 750px) 50vw, 100vw' }}
    {%- endif -%}
    <div>
      {%- if section.settings.eyebrow != blank -%}
        <p class="callout__eyebrow">{{ section.settings.eyebrow | escape }}</p>
      {%- endif -%}
      {%- if section.settings.heading != blank -%}
        <h2>{{ section.settings.heading | escape }}</h2>
      {%- endif -%}
      {{ section.settings.body }}
      {%- if section.settings.link != blank and section.settings.link_label != blank -%}
        <a class="callout__link" href="{{ section.settings.link }}">{{ section.settings.link_label | escape }}</a>
      {%- endif -%}
    </div>
  </div>
{%- endif -%}

{% schema %}
{
  "name": "Product callout",
  "tag": "section",
  "enabled_on": { "templates": ["product"] },
  "settings": [
    { "type": "text", "id": "eyebrow", "label": "Small label", "info": "Connects to single-line text, numbers, dates, measurements and money." },
    { "type": "text", "id": "heading", "label": "Heading", "default": "Why it works" },
    { "type": "richtext", "id": "body", "label": "Text", "default": "<p>Connect this to a product metafield so each product shows its own words.</p>" },
    { "type": "image_picker", "id": "image", "label": "Image" },
    { "type": "text", "id": "link_label", "label": "Link label" },
    { "type": "url", "id": "link", "label": "Link", "info": "Connects to URL metafields, not link metafields." },
    { "type": "color", "id": "text_color", "label": "Text color", "default": "#1a1a1a" }
  ],
  "presets": [ { "name": "Product callout" } ]
}
{% endschema %}

The section restricts itself to product templates with enabled_on, since that's the context in which its sources resolve. It also removes itself when both the heading and text are empty, so a product with no metafield value doesn't get a blank band. Without presets a section can't be added from the editor, and that's easy to confuse with a dynamic source problem.

Connecting a source in the editor

  1. Open the right template

    In the theme editor, open a product template, or the page holding a section with a product or collection setting.

  2. Choose a product to preview

    Pick a product that has a value in the metafield. Otherwise the connected setting renders blank, and it can look like the connection failed.

  3. Click the connect icon

    It's the small icon beside a supported setting. It opens a list of compatible sources, with text fields showing the most options.

  4. Search for more if needed

    If the icon shows a +, you can search for and add further metafields one at a time, up to 20 in a single template.

  5. Check another product

    Switch the preview to a product with no value, and make sure the section still looks right.

Sources as schema defaults

A setting's default, or a value in a presets entry, can point at a source, so a new section arrives already connected:

schema.json
{
  "type": "text",
  "id": "featured_product_title",
  "label": "Featured product title",
  "default": "Featuring: {{ product.title }}"
}

There are two conditions, and both are strict. It's only safe in a context where the value exists, so don't reference product in a section that could land on a page with no product. And you can only reference the value directly: additional Liquid, such as a filter, is invalid and gives an error. Theme blocks have a further form for this, {{ closest.product }}, described in the theme blocks docs.

When to skip sources and write Liquid

Dynamic sources are for a merchant choosing what goes where, one setting at a time. They're less suited to logic. If a section should show a badge only when a metafield is above some value, or loop over a list of ingredients with its own markup, or format a measurement a certain way, read the metafield in the section's code. Our guide to metafields in a section shows how. The downside is that the merchant can't reassign it from the editor without you changing the code.

A reasonable split is sources for visible content, such as headings, images and links, with Liquid for conditions and repeating structures. Whichever you use, deciding this at schema time is cheaper than rebuilding later, and the same setting-type choices come up whenever you make a section editable. A section from Klorr follows the editability level you ask for, but you should still check that a field you plan to connect uses a type from the table above.

Questions, answered

What are dynamic sources in Shopify?

They let a merchant connect a section or block setting to a resource's attribute or metafield in the theme editor, so one template can show each product's own content without code.

Why doesn't my metafield show up as a dynamic source?

Usually the metafield type doesn't match the setting type, as with a link metafield on a url setting, or there's no matching resource on that page. Check the metafield's definition and type in Settings › Custom data.

Can I connect a metafield to a range or number setting?

No. Those setting types aren't on Shopify's compatibility list. Use a text setting, which accepts integer and decimal metafields, or read the metafield in Liquid.

Do I need to change my Liquid code to support dynamic sources?

No. Your code reads the setting as usual, however it's filled. You only need to choose compatible setting types and handle empty values.

Can I use dynamic sources on the home page?

Yes, with some setup. Give a block a product setting, or give the section a collection setting, and the other settings can connect to that resource. Metaobjects with storefront visibility are also available.

Get the whole section written for you

Describe the section you want. Klorr writes the Liquid, the CSS, the schema and every theme-editor setting — code that lives in your theme and stays yours.