• Hello,
    I’m using your plugin long time ago. I was looking for possibility to reset invoice number monthly. Finally I was using the code below, however it stopped works. I don’t change anything I think due to the last update (image issue fix) the below code stopped works.
    Could you check it please? Thank you

    add_action( 'wpo_wcpdf_before_sequential_number_increment', 'wpo_wcpdf_reset_invoice_number_monthly', 10, 3 );
    function wpo_wcpdf_reset_invoice_number_monthly( $number_store, $order_id, $date ) {
        $current_month = date('n');
        $last_number_month = $number_store->get_last_date('n');
        // check if we need to reset
        if ( $current_month != $last_number_month ) {
            $number_store->set_next( 1 );
        }
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor alexmigf

    (@alexmigf)

    Hello @c13ply

    That should work fine and doesn’t seem to be a problem with the last update. Could you check under WooCommerce > Status > Logs if you see any related error?

    Thread Starter c13ply

    (@c13ply)

    Hello,
    there are no related errors :/

    Plugin Contributor Ewout

    (@pomegranate)

    I think this may be related to the date that is used for the reset check. The code checks for the date that the last invoice number was created, which is not necessarily the same as the invoice date (if you have set this to be equal to the order date for example). And to be complete, this code will also not work if you have set the invoice number to be equal to the order number.
    Could you download and install the latest woocommerce-pdf-ips-number-tools.zip from this page and then go to the Number Tools tab in the PDF Invoice settings and check the ‘Invoice Numbers’ section? This will list all invoice numbers since the last reset. If you haven’t reset the invoice numbers manually yet, this might provide insight into what happened.

    Let us know what you find!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Reset Invoice Numbers Monthly’ is closed to new replies.