Product page button that downloads the product tag link

Topic summary

Issue: A merchant wanted to add a button on product pages that downloads PDF instructions from URLs stored in product tags (formatted as PDF_https://...).

Initial Problem: The code was written but wasn’t functioning correctly regardless of placement. The button was redirecting to malformed URLs that included the store domain and the full tag text (e.g., https://gegshop.nl/products/PDF_https://...).

Solution Found: The issue was resolved by removing the PDF_ prefix from the tag when constructing the link. The working code uses Liquid to:

  • Loop through product tags
  • Check for tags containing ‘PDF_https’
  • Strip the ‘PDF_’ prefix using replace: 'PDF_', ''
  • Create a styled button linking directly to the PDF URL in a new tab

Status: Resolved. The merchant successfully implemented the feature and thanked the community for assistance.

Summarized with AI on November 3. AI used: claude-sonnet-4-5-20250929.

Hi all,

I want to add a button on my product page that links to a URL contained in the product tags. Some of these tags have a URL starting with PDF_https://…, which links to a PDF with instructions for a product. By pressing the button, the user should be directed to the URL from the tag in a new page.

I’ve written some code, but no matter where I place it, it doesn’t seem to work.

Here’s the code I have so far:

liquid
{%- for tag in product.tags -%} {%- if tag contains ‘PDF_https’ -%}

{{ tag | strip }}

{%- break -%} {%- endif -%} {%- endfor -%}

I would really appreciate any help on this!

Kind regards,
G&Gshop

Hi @GeGBike , kindly provide your store URL please and if it is password protected, please share the password as well. Thanks

It looks like you’re on the right track by looping through the product tags and checking for those that contain ‘PDF_https’. The issue is likely with how you’re trying to render the button and link to the URL within the tag.

To fix this, you’ll need to update your code slightly to ensure that the URL is used correctly as a link and displayed as a clickable button. Here’s how you can modify your code to create the button that links to the URL contained in the tag:

{%- for tag in product.tags -%}
  {%- if tag contains 'PDF_https' -%}
    
      
    
    {%- break -%}
  {%- endif -%}
{%- endfor -%}

the URL to our store is https://gegshop.nl/

a product with the tag is:

Evotech Ducati Panigale V2 Tail Tidy (2020 - 2024)

https://gegshop.nl/products/evotech-ducati-panigale-v2-tail-tidy-2020-2024?_pos=1&_psq=Evotech+Ducati+Panigale+V2+Tail+Tidy+%282020±+2024%29&_ss=e&_v=1.0

Hi Nabel,

Thx that look a lot better. you byou maby know where i should put it in the code?

I got it to work but when i click the button it send me to the folloing link:

https://gegshop.nl/products/PDF_https://evotech-instructions.s3.eu-west-2.amazonaws.com/instructions/014957+ducati+streetfighter+v4+panigale+v4+tail+tidy+instructions+rev2.pdf

Yet this is not correct. i thout it also need the PDF but it does not and should only be like this:
ttps://evotech-instructions.s3.eu-west-2.amazonaws.com/instructions/014957+ducati+streetfighter+v4+panigale+v4+tail+tidy+instructions+rev2.pdf

otherwise the page they are sned does not work

you need to apply this tag PDF_https to relative product

i figured it out: the PDF_ what messing with the URL so by removing the “PDF_” form the tag it works

{%- for tag in product.tags -%}
{%- if tag contains ‘PDF_https’ -%}


View Instructions (PDF)


{%- break -%}
{%- endif -%}
{%- endfor -%}

thank you Nabeel for the help

1 Like