I am working on a theme created for woocommerce created by some other German developer. I created my child theme and used the functions.php child theme to make changes to the functionality of the website.
When a customer orders a product, he receives an email with an order table, customer information and billing address and customer delivery. I want to delete everything under the table and add my own text (customer information + billing, sending and receiving addresses).
I added my own text right below the order table in the email that is sent to the customer, however I cannot delete the information that appears by default below my custom added text. I found a hook responsible for fetching and showing that data woocommerce_email_order_meta, but I don’t know how to delete it or prevent it from executing. I do not want to make changes to the template files, I want to do all this by intercepting.
So far I have tried to do this as follows:
remove_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text, $email );
I followed the link: Delete the order information section from the email template in woocommerce and tried the following code: but it didn’t work >.
function so_39251827_remove_order_details( $order, $sent_to_admin, $plain_text, $email ){
$mailer = WC()->mailer();
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 );
How can i achieve this?
thank