0

Before I updated all my plugins and WP I had some information displaying in the new order woo email after the total. Like: customer note, email and phone.

But after the updates they are gone. I do not know from where is this information come from. I tried to look in the woo settings but I did not find anything.

Does someone know how to put them back?

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
  • Possible duplicate of [Customize WooCommerce order email](https://stackoverflow.com/questions/33996319/customize-woocommerce-order-email) – LuckyStarr Nov 03 '17 at 11:21

2 Answers2

0

For an example,

 // Edit order items table template defaults
function sww_add_wc_order_email_images( $table, $order ) {

ob_start();

$template = $plain_text ? 'emails/plain/email-order-items.php' : 'emails/email-order-items.php';
wc_get_template( $template, array(
    'order'                 => $order,
    'items'                 => $order->get_items(),
    'show_download_links'   => $show_download_links,
    'show_sku'              => $show_sku,
    'show_purchase_note'    => $show_purchase_note,
    'show_image'            => true,
    'image_size'            => $image_size
) );

return ob_get_clean();
}
add_filter( 'woocommerce_email_order_items_table', 'sww_add_wc_order_email_images', 10, 2 );

For more details,

Link 1, Link 2, Link 3, Link 4

Hope this will helps you.

Sunil Dora
  • 1,407
  • 1
  • 13
  • 26
  • what it is on link 3. The template picture there is a customer details area with email and phone. It is exactly how it was in my new orders email, this area is not there anymore. – Leandro Andrade Nov 03 '17 at 15:22
0

I finally found a solution, including this code in the function.php

function wc_customer_details( $fields, $sent_to_admin, $order ) {
    if ( empty( $fields ) ) {
        if ( $order->get_customer_note() ) {
            $fields['customer_note'] = array(
                'label' => __( 'Customer Note', 'woocommerce' ),
                'value' => wptexturize( $order->get_customer_note() ),
            );
        }
        if ( $order->get_billing_email() ) {
            $fields['billing_email'] = array(
                'label' => __( 'Email address', 'woocommerce' ),
                'value' => wptexturize( $order->get_billing_email() ),
            );
        }
        if ( $order->get_billing_phone() ) {
            $fields['billing_phone'] = array(
                'label' => __( 'Phone', 'woocommerce' ),
                'value' => wptexturize( $order->get_billing_phone() ),
            );
        }
    }
    return $fields;
}
add_filter( 'woocommerce_email_customer_details_fields', 'wc_customer_details', 10, 3 );
Morgoth
  • 4,935
  • 8
  • 40
  • 66