I found this in class-wc-emails.php
function send( $to, $subject, $message, $headers = "Content-Type: text/html\r\n", $attachments , $content_type = 'text/html' ) {
$attachments = array(WP_CONTENT_DIR . '/uploads/invoice.pdf'); //my added code
// Set content type
$this->_content_type = $content_type;
// Filters for the email
add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
// Send
wp_mail( $to, $subject, $message, $headers, $attachments );
// Unhook filters
remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
}
I found this piece of code, where I added in my $attachments variable. But for some reason that doesn not work.
I’m at a loss here.