Add attachment to WooCommerce mail for certain products

Lets say you want an attachment.pdf added to an completed order mail in WooCommerce if certain products are in the order. How do you add and attachment in that case?

With the following code you be able to select one of the mails send in the proces and add the attachment if one of the predefined products is in that order.

If you add the code to your functions.php of your theme and add the attachment.pdf in the same folder, then change the product numbers to your requirements and test.

https://puddinq.mobi/wp-content/uploads/2017/04/variation_id.png

Variation ID

https://puddinq.mobi/wp-content/uploads/2017/04/product_id.png

Product ID

Leave a Reply

Your email address will not be published. Required fields are marked *