Hello
Please, read the topic https://algolplus.freshdesk.com/support/solutions/articles/25000016635-add-calculated-field-for-order-
use metakey german_invoice_numbers and following code
thanks, Alex
add_filter('woe_get_order_value_german_invoice_numbers', function ($value,$order, $field) {
$invoices = wc_gzdp_get_invoices_by_order( $order );
if( $invoices ) {
$numbers = array();
foreach ( $invoices as $id => $invoice ) {
$numbers[] = $invoice->get_title();
}
$value = join(", ", $numbers);
}
return $value;
}, 10, 3);
Thread Starter
urka
(@urka)
Thanks I have add this code and it works well but I need the invoice DATA and I was not able to change the code so it works too.
Please can you help. I wonder if I did not find the solution here in the posts because I think all people will need this field if they have to export data for accountant.
Invoice data or invoice date ?
Hello
Please, follow the topic https://algolplus.freshdesk.com/support/solutions/articles/25000016635-add-calculated-field-for-order-
use metakey german_invoice_dates and this PHP code
thanks, Alex
add_filter('woe_get_order_value_german_invoice_dates', function ($value,$order, $field) {
$invoices = wc_gzdp_get_invoices_by_order( $order );
if( $invoices ) {
$dates = array();
foreach ( $invoices as $id => $invoice ) {
$dates[] = $invoice->get_date_created()->format("Y-m-d");
}
$value = join(", ", $dates);
}
return $value;
}, 10, 3);
-
This reply was modified 3 years, 1 month ago by algol.plus.
Thread Starter
urka
(@urka)
Thank you so much! I had a really stupid mistake in my script.
Now it works fine!