Plugin Contributor
Ewout
(@pomegranate)
Hi! You can resolve this with a small code snippet. I have two flavors for you:
1) Use the completed date (this only works if this was set for those orders!)
add_action( 'wpo_wcpdf_invoice_get_date', 'wpo_wcpdf_order_date_as_invoice_date', 10, 2 );
function wpo_wcpdf_order_date_as_invoice_date( $date, $document ) {
if ($document->get_type() == 'invoice' && !empty($document->order)) {
if( $date_completed = $document->order->get_date_completed() ) {
$date = $date_completed;
}
}
return $date;
}
2) Use the order date (since not all orders may have a ‘completed’ date set):
add_action( 'wpo_wcpdf_invoice_get_date', 'wpo_wcpdf_order_data_as_invoice_date', 10, 2 );
function wpo_wcpdf_order_data_as_invoice_date( $date, $document ) {
if ($document->get_type() == 'invoice' && !empty($document->order)) {
$date = $document->order->get_date_created();
}
return $date;
}
If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use filters
Hope that helps!
Thank you very much Ewout for your help and these snippets !
Best regards,