Adding links from List(File) metafield does not work

Topic summary

Main issue: Product page needs to show downloadable PDF links from a product metafield of type List (file), but links aren’t rendering.

What’s happening: The metafield check passes and outputs an array of GIDs (e.g., gid://shopify/GenericFile/…). Looping over the list and using file_url and file.filename doesn’t produce valid links.

Key detail: The metafield returns file reference IDs, not public URLs. The IDs need to be resolved to actual file objects/URLs before linking.

Suggestions from replies:

  • Use the .value property on the metafield to access usable data from a list metafield in Liquid.
  • Recheck Shopify Liquid docs for handling list metafields and file references.

Context: Code snippets are central to understanding the issue (conditional checks, for-loop, and link generation).

Status: No confirmed solution posted yet; guidance points to dereferencing file references via .value and following Shopify’s metafield list patterns.

Summarized with AI on December 11. AI used: gpt-5.

Hi, I have been creating a product page, and I need to implement download functionality for PDFs that each product might or might not have, its an optional field.

What I need to somehow figure out is how to display and make it possible for customers to download my uploaded PDFs?

I was able to display this:
[“gid://shopify/GenericFile/54152549746”,“gid://shopify/GenericFile/54152527282514”]

”metafield exists and not empty”

{% if product.metafields.custom.ke_stazeni %}

metafield exists and not empty

{% else %}

No data in the metafield.

{% endif %}

{% assign ke_stazeni_files = product.metafields.custom.ke_stazeni %}

{{ product.metafields.custom.ke_stazeni }}

Which confused me even more.

Tried to access the file_url, did not work as well.

{% if product.metafields.custom.ke_stazeni.size > 0 %}

                          <div class="product-documents">

                            <h3>Ke stažení</h3>

                            <ul>

                              {% for file in product.metafields.custom.ke_stazeni %}

                                <li>

                                  <a href="{{ file | file_url }}" download="{{ file.filename }}">

                                    {{ file.filename }}

                                  </a>

                                </li>

                              {% endfor %}

                            </ul>

                          </div>

                        {% else %}

                          <p>No documents available for download.</p>

                        {% endif %}

The slug is correct to the metafield.

I was wondering if anyone was facing similar issue? Thanks for any inputs.

1 Like

hi @frantamrazak :waving_hand: just try .value property.
Then recheck the shopify.dev on metafields lists in the liquid docs

Hi there!

It looks like the metafield is returning a list of file reference IDs, but those IDs don’t automatically include a public URL.