I have set plain text for new orders from woocommerce shop, they are getting printed, fine. But it is important to know the time when the user placed the order. The time is not mentioned on the printed slip. Following is the text/code inside the plain email template.

 do_action( 'woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email );

Can you please advise what i should add in this to get time of order printed?

thank you.


paste this below code your active theme functions.php file

add_action( 'woocommerce_email_order_details', 'order_date_email_hook', 10, 4);

function order_date_email_hook( $order, $sent_to_admin, $plain_text, $email ){
    if ( $sent_to_admin ) 
        echo '<span>Order Date: '.$order->get_date_created().'</span>';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.