shshanker
9/24/2015 - 8:30 AM

attach_terms_conditions_pdf_to_email

attach_terms_conditions_pdf_to_email

<?php
add_filter( 'woocommerce_email_attachments', 'attach_terms_conditions_pdf_to_email', 10, 3);

function attach_terms_conditions_pdf_to_email ( $attachments, $status , $order ) {
	$allowed_statuses = array( 'new_order', 'customer_invoice', 'customer_processing_order', 'customer_completed_order' );

	if( isset( $status ) && in_array ( $status, $allowed_statuses ) ) {
		$your_pdf_path = get_template_directory() . '/terms.pdf';
		$attachments[] = $pdf_path;
	}

	return $attachments;
}

?>