How to Add an Attachment in
WooCommerce Order Emails

Category: WooCommerce
How to Add an Attachment in WooCommerce Order Emails
How to Add an Attachment in WooCommerce Order Emails

To add an attachment to your order emails, open the functions.php file of your child theme and add the following snippet of code:

/**
 * Add Attachment in WooCommerce Order Emails
 * More tips: https://themes.email/woocommerce.html
 */

add_filter( 'woocommerce_email_attachments', 'attach_to_wc_emails', 10, 3);

function attach_to_wc_emails ( $attachments , $id, $object ) {

	$file_path = get_template_directory() . '/file.pdf'; // directory of the current theme

 	 // if a child theme is being used then use this line to get the directory
 	// $file_path = get_stylesheet_directory() . '/file.pdf';

	$attachments[] = $file_path;
	return $attachments;
}
                                    

Just edit the $file_path variable to get the file location.

Tutorials

Purchase Email Templates

Each purchase of WET comes with 20 different styles —
and a lifetime of free fresh designs & bug-fix updates.

One purchase for all your future projects.