0

I am trying to remove the order details table from every completed order mail:

order details table

I have tried something like this:

function so_39251827_remove_order_details( $order, $sent_to_admin, $plain_text, $email ){
    $mailer = WC()->mailer(); // get the instance of the WC_Emails class
    remove_action( 'woocommerce_email_order_details', array( $mailer, 'order_details' ), 10, 4 );
}
add_action('woocommerce_email_order_details','so_39251827_remove_order_details', 5, 4 );

It actually did remove the table but I am thinking the hook is removed from entirely all mail notifications, that's both the admin and customer mail template.

Can somebody help me on how to remove it from only completed order mail sent to customers?

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
Xwebyna
  • 54
  • 5
  • Welcome to SO. Please finish the tour and you will understand [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) and modify question accordingly to minimal working example. Without posting your code you risk removal of your question. With your stated trail and error code... people are more willing to help you so both can learn. Enjoy SO ;-) – ZF007 Jan 13 '18 at 23:41

1 Answers1

-1

copy this email template \wp-content\plugins\woocommerce\templates\emails\customer-completed-order.php

to your theme here \wp-content[theme_folder]\woocommerce\emails\customer-completed-order.php

and comment our this line

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

that should remove the order details table just from the customer email.