JSFiddle - React, Tailwind, and code Playground

by Jonas Bronée

JavaScript

add_filter( 'woocommerce_email_attachments', 'attach_terms_conditions_pdf_to_email', 10, 3);
function attach_terms_conditions_pdf_to_email ( $attachments, $status, $object) {
        $allowed_statuses = array('customer_processing_order');
        if( isset( $status ) && in_array ( $status, $allowed_statuses ) ) {
           $your_pdf_path = get_stylesheet_directory() . '/handelsbetingelser.pdf';
            $attachments = [
               $your_pdf_path,
            ];
              
        }
    return $attachments;
}