How can I display a PDF download link in a customer order?

Hi,
I have a link to PDF file in the customer order backend, how to show it as download link in the customer order frontend page?

Also can I transfer the PDF pages to individual images, then add both the PDF files + the images to the order frontend page?

  1. In the theme editor, navigate to the template file that renders the customer order frontend page. This file might vary depending on the theme you’re using. Look for a file related to orders, such as order.liquid or order.liquid.
  2. Within the template file, locate the section where the order details are displayed. This section might include variables like order.line_items or order.products.
  3. Find the relevant line where you want to display the PDF download link. Depending on the structure of the template, it could be within a loop that iterates over the order line items or in a specific section for displaying additional information.
Download PDF
​

I am using Craft theme

I am not sure what is the your_namespace.your_key

Hello @CreativeMind202 ,

You can try to follow these steps:

Go to Online Store → Themes → Actions → Edit code

Go to Sections → order.liquid file

Modify the code to display a download link for the PDF file. Here’s an example:

{% if order.pdf_file_url %}
  Download PDF
{% endif %}

Save changes

Hope this can help. Let us know if you need any further support.

Ali Reviews team.

Unfortunately, this didn’t work!

Hello @CreativeMind202 ,

I’m sorry for that. Here is another solution you can try to follow to display a PDF file as a download link on the customer order frontend page:

  • Go to Online Store → Themes → Actions → Edit code
  • Go to Templates → order.liquid
  • Search for the section where the customer order details are displayed, typically within a {% for line_item in order.line_items %} loop. It might look something like this:
{% for line_item in order.line_items %}
  
{% endfor %}
  • Add the following code to create the download link for the PDF file:
{% if line_item.properties.pdf_file %}
  Download PDF
{% endif %}
  • Save changes

Hope this can work. Let us know if you can make it or not.

Ali Reviews team.

1 Like

Thank you very much, your solution gave me the hint on how to solve it!
Your solution is not wrong and I will accept as solution, but instead of the .pdf_file the variable assigned by the app developer should be used.