• Resolved stani17

    (@stani17)


    Hi people,
    I would ask you for your help. I want to send pdf invoices, which are generated with my invoice creating software and saved and uploaded as a pdf.
    So the idea is to create the invoice as a pdf, save it and upload it with a specific name for instance invoice_”ordernumber”.pdf and send it with the “order completed” email.
    I have the following code:

    //Filter-Hook für Woocommerce
    add_filter( 'woocommerce_email_attachments', 'widerrufsbelehrung_email', 10, 3);
    
    function widerrufsbelehrung_email ( $anhang, $status , $bestellung ) {
    
    $anhang_bei_status = array( 'customer_completed_order' );
    
      if( isset( $status ) && in_array ( $status, $anhang_bei_status  ) ) {
    
         $widerrufsbelehrung = get_template_directory() . '/PDF/Widerrufsbelehrung.pdf';
    
         $anhang[] = $widerrufsbelehrung;
      }
    
      return $anhang;
    }

    My question: how could I change the static attachment with a dynamic one?
    How can I apply get_order_number()

    Many thanks in advance
    Bests

Viewing 2 replies - 1 through 2 (of 2 total)
  • melinda a11n

    (@melindahelt)

    Automattic Happiness Engineer

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Mirko P.

    (@rainfallnixfig)

    Hi there,

    We’ve not seen any activity on this thread for a while, so I’m marking this thread as resolved.

    Hopefully, you were able to find a solution and the above resources for developers were helpful. If you have further questions, please feel free to open a new topic.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Woocommerce Email dynamic attachments’ is closed to new replies.