Hi @bigsavagepapa,
In order to include the complete time for the Order Date, you have to add the order date format which you want in print-content.php file which is located at \woocommerce-delivery-notes\templates\print-order\print-content.php.
Please let us know if you have any further queries.
Regards,
Kenil Shah
Yes, you can override Print-content.php and modify the date format there, or what I did is add the following to my Child functions.php file:
add_filter ( 'wcdn_order_info_fields', 'update_wcdn_order_date_value', 10 , 2 ) ;
function update_wcdn_order_date_value ( $values, $order ) {
$wdn_order_id = ( version_compare( get_option( 'woocommerce_version' ), '3.0.0', ">=" ) ) ? $order->get_id() : $order->id;
$order_post = get_post( $wdn_order_id );
$wdn_order_order_date = ( version_compare( get_option( 'woocommerce_version' ), '3.0.0', ">=" ) ) ? $order_post->post_date : $order->order_date;
$values['order_date'] = array(
'label' => __( 'Order Date', 'woocommerce-delivery-notes' ),
'value' => date_i18n( __( 'l m/d/Y, h:ia', 'woocommerce' ), strtotime( $wdn_order_order_date ) )
);
return $values;
}
Results looks like:
Order Date Thursday 09/05/2019, 03:56pm
There might be a better way of doing it, I am always open for making improvements.
Hi @mowlman,
Thank you for sharing the code and providing the solution to us.
Regards,
Kenil Shah
Hi @mowlman question I added the order time on it like you said . Is there a way to format the order date to include complete time?
Order Date Thursday 09/05/2019, 03:56pm code is already in but now I would like to also have its say complete date Thursday 9/05/2019 4:30pm on the same Receipt
Hello bigsavagepapa, I may have misunderstood your original question, sorry, and was thinking you wanted to display the Order Date with the time; however, now I am thinking you want the order “Completion” Date with time?
I do not have a ready answer, but it looks like you need to pull in and display _completed_date from the wp_postmeta for the given order id? The value for _completed_date on one of my completed orders looks like: 2019-10-28 09:23:56
Might be able to change the above code to include $order->completed_date; instead of $order->order_date; ??
You also might be able to use something like: $order->get_date_completed();
Perhaps plugin support can shed more light for a solution
Hi @bigsavagepapa,
In order to add the order completion date, can you please try the below code and check whether it is working fine or not.
Code:
echo date( ‘j-n-Y’, strtotime($order->get_date_completed()));
Please let us know how it goes.
Regards,
Kenil Shah