• dailyprestau

    (@dailyprestau)


    Hi,

    On our website customers can order fresh food ingredients for meals. For each specific meal we would like to automatically email them a recipe/guideline in PDF format when they order.

    Is there any way to do this?

    Thanks,
    Ashraf

    [Moderator Note: No bumping, thank you.]

Viewing 3 replies - 1 through 3 (of 3 total)
  • You can attach pdf file with order email by using the below code in your functions.php
    add_filter( ‘woocommerce_email_attachments’, ‘attach_recipe_guideline’, 10, 3);
    function attach_recipe_guideline ( $attachments, $status , $order ) {
    $allowed_order_statuses = array( ‘new_order’, ‘customer_processing_order’, ‘customer_completed_order’ );
    if( isset( $status ) && in_array ( $status, $allowed_order_statuses ) ) {
    $pdf_path = get_template_directory() . ‘/terms.pdf’;
    $attachments[] = $pdf_path;
    }
    return $attachments;
    }

    Thread Starter dailyprestau

    (@dailyprestau)

    Thanks., I added the code to functions.php. But I do not quite understand where to go from here…where can I upload the PDF recipe of a specific meal?

    You have to add code for uploading recipies pdf.In above code only already uploaded pdfs are attached with order email.Path of the pdf is defined here : $pdf_path = get_template_directory() . ‘/terms.pdf’; you can change it as you want.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Email guideline PDF when a product is ordered’ is closed to new replies.