• Resolved nitsuj1001

    (@nitsuj1001)


    Hi,

    im working on a plugin, which can send (wc-style) e-mails to specific users manually.

    But I need to attach an invoice to this emails. The invoice is designed via a template.
    My question is now, is there a way or a function to generate invoice manually and attach it to my custom mail?

    (I already know, how to send e-mails via WooCommerce)

    Thanks in advance

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    I’m not sure I understand the question, but if you create an order, our plugin can generate an invoice for it. Depending on how you are currently sending the email, you can then use woocommerce_email_attachments to add the invoice.

    Thread Starter nitsuj1001

    (@nitsuj1001)

    Thanks for ur fast response.
    Its not quite what I mean.

    My plan is to send a monthly sum with all sold products incl. tax to my vendors. Not on each purchase.
    I will gather the information by myself (sum of products, tax) and just want to generate the pdf with your plugin and my information, and then send it together with my custom mail to the user.

    So im wondering if there is function like that:

    string generate_invoice($userinfo, $storeinfo, $content) par example which gives me a pdf file back

    Plugin Contributor Ewout

    (@pomegranate)

    unfortunately not, our plugin can only generate an invoice with order data.
    You could use the dompdf wrapper that we provide and feed your own HTML, if you like:

    
    $html = ''; // parse your own template etc.
    $pdf_settings = array(
    	'paper_size'		=> 'A4',
    	'paper_orientation'	=> 'portrait',
    	'font_subsetting'	=> true,
    );
    $pdf_maker = wcpdf_get_pdf_maker( $html, $pdf_settings );
    $pdf = $pdf_maker->output();
    

    then store that PDF on your server and pass it to woocommerce_email_attachments. Not trivial stuff though. Hope that helps!

    Thread Starter nitsuj1001

    (@nitsuj1001)

    Ok thank you, I’ll look what I can achieve 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Manuelly generate invoice’ is closed to new replies.