Attach a local file after AutomateWoo builds a workflow email. Change the path and keep the readability check so a missing file does not generate a mailer warning.
Developer note:
Add custom PHP in a small custom plugin or child theme, and test it on a staging site before production. This example requires ongoing maintenance when extension APIs change.
functions.php
<?php
add_filter( 'automatewoo/workflow/mailer', 'my_store_add_workflow_email_attachment' );
/**
* Add a PDF attachment to AutomateWoo workflow emails.
*
* @param AutomateWoo\Mailer_Abstract $mailer Workflow mailer.
* @return AutomateWoo\Mailer_Abstract
*/
function my_store_add_workflow_email_attachment( $mailer ) {
$attachment = get_stylesheet_directory() . '/documents/terms.pdf';
if ( is_readable( $attachment ) ) {
$mailer->attachments[] = $attachment;
}
return $mailer;
}