I overrided Woocommerce admin-new-email.php with some custom meta, in addition, I have added a filter to add attachment file from an ACF options page file field.
function attach_order_notice ( $attachments, $email_id, $order ) {
// Only for "New Order" email notification (for admin)
error_log( 'attachments: '. print_r( get_field( 'email_file_attachment', 'options' )['url'], true ) );
//if( $email_id == 'new_order' ){
$attachments[] = get_field( 'email_file_attachment', 'options' )['url'];
//}
return $attachments;
}
add_filter( 'woocommerce_email_attachments', 'attach_order_notice', 10, 3 );
When I check the log I get a URL to a PDF file and is viewable, when I receive the email there is no file attached, not to admin email nor customer email.
What could be the reason? Thanks