• Resolved luis334

    (@luis334)


    Hello,

    I’m trying to solve this I don’t know how to do it:

    I need the plugin to automatically generate the PDF invoice when the customer places an order and makes payment but I don’t want that invoice to be sent as a PDF attachment when the customer receives the purchase confirmation email. I wonder if there are any hook/filter that could prevent the PDF of the invoice from being sent?

    I don’t want the PDF invoice to be sent by email to the site administrator either, as I prefer to download it later from the WP itself. The invoice will only be sent on paper inside the package with the items sold.

    Thank you for your help,
    Luis

    • This topic was modified 3 years, 10 months ago by luis334.
    • This topic was modified 3 years, 10 months ago by luis334.
    • This topic was modified 3 years, 10 months ago by luis334.
    • This topic was modified 3 years, 10 months ago by luis334.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Yordan Soares

    (@yordansoares)

    Hello @luis334,

    To disable the invoice attachments in your mails, you should to go to Dashboard > WooCommerce > PDF Invoices > Documents and uncheck all the order status emails in the Attach to option.

    Let me know if you need more help!

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hello again @luis334,

    I read your message again, and I think my previous message didn’t answer to your question, sorry!

    The default way to do this would be to attach it to the Processing Order email, but if you don’t want to attach it to any email but only create the invoice programmatically, you can do this by hooking into one of the WooCommerce order status action hooks.

    $invoice = wcpdf_get_document( 'invoice', $order, true );

    You could tie this to hooks like woocommerce_order_status_completed or woocommerce_order_status_processing:

    add_action('woocommerce_order_status_processing', 'wpo_wcpdf_create_invoice_number');
    function wpo_wcpdf_create_invoice_number ( $order_id ) {
    	$order = wc_get_order( $order_id );
    	$invoice = wcpdf_get_document( 'invoice', $order, true );
    }

    Hope this help you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Automatically generate PDF invoice without it being sent to the customer/owner’ is closed to new replies.