Please add the snippet below:
/**
* PDF Invoices & Packing Slips for WooCommerce
* Add [order_year+1] placeholder for invoice number
*/
function wpo_invoice_number_custom_placeholder( $formatted_number, $document_number, $document, $order ): string {
if ( strpos( $formatted_number, '[order_year+1]' ) === false || 'invoice' !== $document->get_type() ) {
return $formatted_number;
}
$order_date = is_callable( array( $order, 'get_date_created' ) ) ? $order->get_date_created() : null;
if ( empty( $order_date ) && function_exists( 'wc_string_to_datetime' ) ) {
$order_date = wc_string_to_datetime( date_i18n( 'Y-m-d H:i:s' ) );
}
$order_year = ! empty( $order_date ) ? $order_date->date_i18n( 'y' ) + 1 : null;
return str_replace( '[order_year+1]', $order_year, $formatted_number );
}
add_filter( 'wpo_wcpdf_format_document_number', 'wpo_invoice_number_custom_placeholder', 10, 4 );
After that, use this placeholder: [order_year+1]
.
You might need to disable the previous snippet.
Best regards