Adding link to download file from metafield

CreativeMind202
Excursionist
29 1 1

Hi,

I am using the following code to display a link to download a zip file added to a meta field

{% comment %}Custom Code to Show Custom File Uploaded to the customer order{% endcomment %}
            <td>  {% if order.metafields.custom.order_mockup_file %}
              <a href="{{ order.metafields.custom.order_mockup_file.file}}" download>Download Customized File</a><br>
              {% endif %}</td>
            
            {% comment %}END of Custom Code to Show Custom File Uploaded to the customer order{% endcomment %}

but it keeps giving me the HTML file, not the zip file?

Reply 1 (1)
jessie_monument
Shopify Partner
5 0 1

@CreativeMind202 it's been a while since this question was posted but for anyone else looking, I think the right code would be:

{% comment %}Custom Code to Show Custom File Uploaded to the customer order{% endcomment %}
            <td>{% if order.metafields.custom.order_mockup_file != blank %}
              <a href="{{ order.metafields.custom.order_mockup_file | file_url }}" download>Download Customized File</a><br>
              {% endif %}</td>
            
            {% comment %}END of Custom Code to Show Custom File Uploaded to the customer order{% endcomment %}