Reset invoice number by daily
-
Hello,
We would like to have invoice number reset by daily and using below code snippet, but it seems that the order date seems to get post_date_gmt date instead of post_date? the problem is the invoice number duplicated with same running number 001 when local time (current date) is over 12am something on 27 Aug but GMT time is still 26 Aug, it will always start with ‘1’, kindly advise how can we fix this? thanks.
add_action( 'wpo_wcpdf_before_sequential_number_increment', 'wpo_wcpdf_reset_invoice_number_daily', 10, 3 ); function wpo_wcpdf_reset_invoice_number_daily( $number_store, $order_id, $date ) { if ( $number_store->store_name == 'invoice_number' ) { $current_day = date('z'); $last_number_day = $number_store->get_last_date('z'); // check if we need to reset if ( $current_day != $last_number_day ) { $number_store->set_next( 1 ); } } }
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
The topic ‘Reset invoice number by daily’ is closed to new replies.