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

    (@pomegranate)

    Hello Lawrence,
    Because in many countries, the invoice numbers need to be sequential and not all orders are always completed, the invoice number is not generated until the invoice itself is actually generated!
    The simple solution is to attach the invoice to the admin new order email, but that will obviously also attach the invoice.

    If you don’t want that, you can add this small code snippet to your theme’s functions.php:

    add_action('woocommerce_checkout_order_processed', 'wpo_wcpdf_create_invoice_number');
    function wpo_wcpdf_create_invoice_number ( $order_id ) {
    	global $wpo_wcpdf;
    	$invoice_number = $wpo_wcpdf->export->set_invoice_number( $order_id );
    }

    Note: be careful editing functions.php on a live site! Always make sure you have a backup you can restore via FTP in case of copy paste errors or other unforeseen issues.

    Thread Starter lawkwok

    (@lawkwok)

    Perfect. That worked!

    Plugin Contributor Ewout

    (@pomegranate)

    Great, thanks for reporting back!

    Hi Ewout,
    I wrote for the opposite problem —-
    the same problem of Peter.
    How did you solved it? did you?
    i’ve set the plugin to don’t attach any invoice to emails that are sent out before the order is completed.
    But as soon an order is request the plugin generate the pdf invoice and the Packing Slip.
    The two pdf are in my panel area but it already has generated a number. so if one order in not being payed or cancell the following invoice has a sequencial number. What can I do to make the plugin generate the pdf invoice file only after the completed order?

    thank you for your help and attention…
    i’m really stuck by this problem.

    Plugin Contributor Ewout

    (@pomegranate)

    Hi Lisangel,
    It’s better if you open your own thread. I have already responded to your question in another thread, let’s keep the conversation in there!

    Ewout

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Generate Invoice # as soon as order received’ is closed to new replies.