Print & PDF: Easy Digital Downloads in Shopify

Print & PDF: Easy Digital Downloads in Shopify

I’ve been asked a few times about my process for sending out digital downloads (PDFs) when people buy physical books from my shop.

Rather than using 3rd party plugins, I use Shopify’s built-in functionality to automatically add a download link to confirmation emails. You can use Dropbox, Google Drive, OneDrive, or any other file-sharing service capable of generating a public link.

If you’re interested in using this method for your Shopify instance, here’s the process:

1. Adding a New Metafield

Add a new Metafield by going to Settings -> Metafields -> Products and clicking on Add Definition.

Screenshot 2023-01-03 151558

Fill out the definition as follows:

  • Name: Download URL
  • Namespace and key: my_fields.download_url

  • Description: Link to PDF Download

  • Content Type: URL

Screenshot 2023-01-03 151112

Click Save. This new Metafield will now appear on all Products in the Metafields section.

2. Editing the Notification Template

Modify the Order Confirmation notification template by going to Settings -> Notifications -> Order Confirmation (under Orders) and clicking Edit Code.

Screenshot 2023-01-03 151942

Look for the line containing the following code:

{% if line.variant.title != 'Default Title' %}
            <span class="order-list__item-variant">{{ line.variant.title }}</span><br/>
          {% endif %}

And add the new code snippet beneath it. Click Save.

      {% if line.product.metafields.my_fields.download_url != blank %}
            <p><a href="{{ line.product.metafields.my_fields.download_url }}">PDF Download Link</a></p>
      {% endif %}

Screenshot 2023-01-03 152426

When Shopify sends a confirmation email on future orders, it’ll check each product for the my_fields.download_url Metafield and insert that URL as a link labelled “PDF Download Link.”

Open an existing product or add a new one and look for the Metafields section. There should now be a new entry called Download URL. Click into the blank box and paste in your product’s download link (from Dropbox, Google Drive, etc.).

Screenshot 2023-01-03 153341

Save the product. Repeat for any product that has a digital download.

You can confirm this is working as intended by reviewing the Order Confirmation notification template (Settings -> Notifications -> Order Confirmation), which should now include the PDF Download Link (assuming the product pulled through in the preview has a download URL added).

Screenshot 2023-01-03 153932

Some things to bear in mind:

  • This method is intended for static URLs, ie. URLs that don’t change very often. It’ll be the same URL for every customer, so there’s a chance of them getting into the wild (a small price to pay, in my opinion).
  • I usually share out folders containing PDFs since sharing out the files themselves can cause issues in different browsers.
  • Shopify fires out the link as soon as the order is confirmed, so there’s no option to rescind the link if the order is refunded, etc.
  • You can change the formatting and placement of the PDF Download Link but that’s outside the scope of this post.

© 2022. All rights reserved.