Actually, there’s a better method that changes the invoice date itself, by using a filter:
add_filter( 'wpo_wcpdf_invoice_get_date', function( $date, $document ) {
if ( $document->get_type() == 'invoice' && $order = $document->order ) {
if ( $completed_date = $order->get_date_completed() ) {
$date = $completed_date;
} else { // fallback to order date
$date = $order->get_date_created();
}
}
return $date;
}, 10, 2 );
If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use filters
If you do prefer to print the “Completed date” as a separate date on the invoice, you should use the official WooCommerce method rather than calling it as a custom field, because technically it’s an order property (which is similar to custom fields, but behaves somewhat different):
// get formatted completed date (fallback to order date)
$completed_date = $order->get_date_completed() ? $order->get_date_completed()->format( wc_date_format() ) : $order->get_date_created()->format( wc_date_format() )
Hope that helps!