Solved

Can someone help: We made a section for links but we need the link to be dynamic source

TUB
Tourist
4 1 1

Hello, we are really stuck and would love someone help. 

 

So I will give you a little background as to why we need this. We have multiple brands and products on our website, and currently creating a theme per collection to avoid duplicate content, but because we are using the same theme for a whole collection we need some sections to be unique therefore we are using dynamic source. 

 

We have added new sections, one of the sections is a link sections for PDF (this is specifically for fitting instructions). There is an image and a h tag which we are able to make dynamic source, then when you click on this it links to the PDF.

 

We have managed to make the heading and image dynamic source but not the link.... and this is the problem. 

 

Ideally we would be able to add dynamic source in the link section, so it will be unique. But i can only add files or images to dynamic source not a link... Plus the link section inside template will only take a link not a file. 

 

if someone has any advice on this we would truly appreciate it!

Accepted Solution (1)

topnewyork
Navigator
298 34 45

This is an accepted solution.

Hello @TUB,

  1. Add Metafields for PDF Links:

    • In Shopify admin, go to Settings > Metafields.
    • Create a metafield for PDF links (e.g., namespace instructions, key pdf_link, type URL).
  2. Assign Metafields to Collections/Products:

    • Go to each collection or product and add the PDF link in the metafields section.
  3. Modify Theme Code:

    • Open your theme editor and navigate to the relevant section template.
    • Insert liquid code to use the metafield value dynamically:
      {% assign pdf_link = collection.metafields.instructions.pdf_link %} <a href="{{ pdf_link }}" target="_blank"> <img src="{{ section.settings.image }}" alt="{{ section.settings.image_alt }}"> <h2>{{ section.settings.heading }}</h2> </a>
  4. Test:

    • Preview your collections to ensure the PDF links are dynamic and correct.

By using metafields, you can dynamically assign PDF links, avoiding duplicate content and maintaining unique sections for each collection.

Thanks!

Need a Shopify developer?
Hire us at topnewyorkwebdesign.com
For Shopify Design Changes | Shopify Custom Coding | Custom Modifications
Subscribe to our youtube channel

View solution in original post

Replies 4 (4)

Liqiud_xPert_SJ
Shopify Partner
991 118 153

@TUB 

 

Hi this can be done by metafields dynamic source. You can create metafields and call them into your custom section.

- If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response.
- Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
- Your Shopify Solution Specialist For further discussion contact: Email ID- Liqud_3xPert_SJ OR Whatsapp
- Buy a Coffee for me to get more frequently help 🙂
- Hire Me to unlock the full potential of your e-commerce store Now 🙂- If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response.
- Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
- Your Shopify Solution Specialist For further discussion contact: Email ID- Liqud_3xPert_SJ OR Whatsapp
- Buy a Coffee for me to get more frequently help 🙂
- Hire Me to unlock the full potential of your e-commerce store Now 🙂

topnewyork
Navigator
298 34 45

This is an accepted solution.

Hello @TUB,

  1. Add Metafields for PDF Links:

    • In Shopify admin, go to Settings > Metafields.
    • Create a metafield for PDF links (e.g., namespace instructions, key pdf_link, type URL).
  2. Assign Metafields to Collections/Products:

    • Go to each collection or product and add the PDF link in the metafields section.
  3. Modify Theme Code:

    • Open your theme editor and navigate to the relevant section template.
    • Insert liquid code to use the metafield value dynamically:
      {% assign pdf_link = collection.metafields.instructions.pdf_link %} <a href="{{ pdf_link }}" target="_blank"> <img src="{{ section.settings.image }}" alt="{{ section.settings.image_alt }}"> <h2>{{ section.settings.heading }}</h2> </a>
  4. Test:

    • Preview your collections to ensure the PDF links are dynamic and correct.

By using metafields, you can dynamically assign PDF links, avoiding duplicate content and maintaining unique sections for each collection.

Thanks!

Need a Shopify developer?
Hire us at topnewyorkwebdesign.com
For Shopify Design Changes | Shopify Custom Coding | Custom Modifications
Subscribe to our youtube channel
TUB
Tourist
4 1 1

That's amazing! thank you so much, it worked. Appreciate it a lot. 

gr_trading
Shopify Partner
1822 143 189

Hi @TUB ,

 

it seems like you are having problem linking PDF to dynamic source.

 

Request you to refer the below video where we have add PDF file link using dynamic source.

 

https://youtu.be/gHt96kSrs9M?si=SjUHCVwqSZFJS_mw

 

Let me know if you have any doubts or we understand your requirement correct?

For any custom development WhatsApp or connect at Email ID: gr.trading15@gmail.com for quick consultation. | Shopify Free codes
To support Buy Me a Coffee