Link/file in order confirmation Dawn Theme

Hello Shopifyer,

I think I posted the question on the wrong board, so I’ll try again here.

I would like to include a PDF file or a download link, specific to the product (info sheet on using THIS product) in the confirmation email to the customer.

I have created 2 meta fields in the product for this purpose. One meta field in which I can place the PDF file directly (all file types permitted) and one meta field with the link to the PDF.

I created the definitions in the meta field for the link like this…

custom.link_zum_infoblatt

and for the file as an attachment…

custom.dateianhang_infoblatt

see image below

In the products of the test order/mail, the two meta fields are filled with a file or link.

I use this code for the template…

      {% endunless %}
    </td>
  </tr>
</table>
      {% assign product_titles = '' %}
        {% for line_item in line_items %}
            {% assign product_title = line_item.title | escape %}
            {% unless product_titles contains product_title %}
                <p>Vielen Dank für den Kauf von {{ product_title }}! Sie können das Infoblatt für dieses Produkt <a href="{{ line_item.product.metafields.custom.link_zum_infoblatt_url }}" style="color: blue; text-decoration: underline;">hier herunterladen</a>.</p>
                {% assign product_titles = product_titles | append: product_title | append: ',' %}
            {% endunless %}
        {% endfor %}

and get this result…

wow, really nice, but the links are not clickable.

I think it’s just a small thing that’s causing it to fail and I’ve tried a few things but can’t solve it.

Maybe you can help.

@pfannenwender hey, thanks for posting here.
let me test it on sanbox, thanks.

@pfannenwender do you try

line_item.product.metafields.custom.link_zum_infoblatt.url

NOT :

infoblatt_url
1 Like

Many Thanks ProtoMan44,

sometimes its a big difference betweet two lines and a simple dot.

As a non-coder and copy/paster you dont know this :wink:

Works perfekt, thanks

1 Like

@pfannenwender not a problem i appreciate that you wrote this code with new idea. :tada: :sparkles:

1 Like