/**
* Get email attachments.
*
* @return array
*/
public function get_attachments() {
return apply_filters( 'woocommerce_email_attachments', array(), $this->id, $this->object );
}
Возвращает пустой массив, если ничего не добавлено.Пример кода для добавления вложения
add_filter( 'woocommerce_email_attachments', 'conditions_pdf_to_email', 10, 3);
function conditions_pdf_to_email ( $attachments, $status , $order ) {
$allowed_statuses = array( 'new_order',);
if( isset( $status ) && in_array ( $status, $allowed_statuses ) ) {
$your_pdf_path = get_template_directory() . '/terms.pdf';
$attachments[] = $pdf_path;
}
return $attachments;
}