• Hi,

    As the title says, is it possible to automatically reset the sequential numbering each month?

    Here’s what I want to achieve:

    January:
    invoice 001-01-2021
    invoice 002-01-2021
    invoice 003-01-2021
    invoice 004-01-2021

    February:
    invoice 001-02-2021
    invoice 002-02-2021
    invoice 003-02-2021
    invoice 004-02-2021

Viewing 1 replies (of 1 total)
  • Plugin Contributor alexmigf

    (@alexmigf)

    Hello @gotosleep

    Please add the code snippet below to your theme functions.php file:

    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 );
        }
    }

    If you never worked with actions/filters please read this: How to use filters

Viewing 1 replies (of 1 total)
  • The topic ‘Reset sequential numbering every month’ is closed to new replies.