0
votes

How do I remove the first row only (Product name, Quantity and Price) from woocommerce_email_order_details?

This is how email looks right now

Currently admin_new_order.php contains the following code

<?php    

 if ( ! defined( 'ABSPATH' ) ) {
    exit;
 }


 do_action( 'woocommerce_email_header', $email_heading, $email ); ?>

 <p><?php printf( __( 'You have received an order from %s. The order is as follows:', 'woocommerce' ), $order->get_formatted_billing_full_name() ); ?></p>

 <?php


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


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


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


 do_action( 'woocommerce_email_footer', $email );

woocommerce_email_order_details is the function that creates all the elements you see in the picture. I know I shouldn't remove the whole function because other functions might be using this function. So how do I access only the first row so that I can remove it?

1

1 Answers

1
votes

Try 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 );