sending pdf after someone makes a purchase on a woocommerce site

Hi,
A client wants to email the following PDF file when someone makes a successful purchase on their woocommerce site. Can this be done?
https://drive.google.com/file/d/0B_8yljMIV4IQS0pYZVZEQ1JwWjYzanFrVFlvOHdTUWNvTWsw/view?usp=sharing

  • Elliot Sowersby
    • The Incredible Code Injector

    Try adding this code to your functions.php, then upload the PDF file named agreement.pdf to your theme directory.

    add_filter( 'woocommerce_email_attachments', 'attach_order_terms', 10, 3 );
    function attach_order_terms ( $attachments, $email_id, $order )
    {
        // Only for "Completed Order" email notification
        if( $email_id == 'completed_order' ){
            $attachments[] = get_template_directory() . '/agreement.pdf';
        }
        return $attachments;
    }

    I've not fully tested this exact code but should work fine. If it doesn't work let me know I'll test it out. :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.