How do I change the invoice date?

In order to change the invoice date, simply add the following filter to your themes  functions.php

/**
 * Change invoice date to order date in order to regenerate old invoices and keep the date.
 *
 * @param string                 $invoice_date date of invoice.
 * @param BEWPI_Abstract_Invoice $invoice      invoice object.
 *
 * @return string needs to be in mysql format.
 */
function change_invoice_date_to_order_date( $invoice_date, $invoice ) {
    // get_date_paid() or get_date_created().
    $date_completed = $invoice->order->get_date_completed();
    if ( null !== $date_completed ) {
        return $date_completed->date( 'Y-m-d H:i:s' );
    }

    return $invoice_date;
}
add_filter( 'wpi_invoice_date', 'change_invoice_date_to_order_date', 10, 2 );
	

Please test the functionality on a development environment of your website. If it ceases to work, please revert back to the original state of your website and follow the tutorial again.