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.
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’ -%}
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 -%}