The Blog

Add PDF to WooCommerce Order Email

Quick little snippet that will let you add 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?


Introducing Metorik


A single dashboard unifying your store's orders, customers, and products, helping you understand your data and make more informed decisions.