Attach PDF to WooCommerce Order Emails

...
Bryce Adams

Sometimes you might want to include a static PDF with your WooCommerce Order Emails. You might want to include a PDF version of their invoice or provide some additional instructions to your customer.

Today we are going to list 2 ways you can do this: one requires a bit of coding knowledge and the other can be done by anyone!

Method 1: Code snippet

This quick little snippet will let you attach a static PDF file (or in fact, any kind of file) to the WooCommerce Order Emails.

Just add the following code to the ‘custom functions’ area of your functions.php file:

Delete the first line if you are having errors come up after saving the file.

Now simply edit the $your_pdf_path variable to be wherever your PDF (or other file) is located. Keep in mind that the PDF path needs to be where the actual file is located on your server - not a URL.

If you were using a child theme, you could use get_stylesheet_directory_uri to get the file location in the child theme's folder.

Similarly, you'd use the wp_upload_dir function to get a file in your uploads directory.

Too easy, right?

Reference: http://wordpress.org/support/topic/pdf-attach-terms-and-conditions-to-email

Method 2: Metorik Engage

Metorik Engage allows you to send automated emails to your WooCommerce customers. So what does this mean? Well at a minimum you can send all your basic transactional WooCommerce emails, including order emails. At a maximum, you can send any email you can dream of to any specific segment of customers.

So how do we include a PDF (or any file type) in an order email using Engage? Well, you can customise your order emails to include a link to your hosted file. 

So first I'm going to create a new order marked completed email. We already have a template for this email + many others:

Next, we can select the filters that determine when the email will send. I'm going to use the default ones already selected:

Now for the fun part. From the message section, we can customise what we include in the actual email. Rather than attaching a PDF here, I am going to do is include a hyperlink to a hosted JPG file. I've found a photo of a Corgi on Google, but this is where you would link to shipping instructions or an instruction manual, for example.

Select the text, in my case, the word photo, and then click the link button in the toolbar:

Now paste in the link to the file:

Click Save & Continue - and you're ready to go!

Now, when a user is sent an order confirmation email they will see this:

And if they click on the hyperlink, they will see our cute little friend:


Want to try Metorik today?

We're so sure you'll love Metorik that you can start right now, for free, without a credit card - and use it without limits for 30 days.

Get started for free