tombo80
tombo80

Reputation: 45

Remove Downloads section from Woocommerce order refunded email

I have seen this snippet which removes from all customer emails, however I'm wondering how to remove the downloads section from the Woocommerce email: Order Refunded.

add_action( 'woocommerce_email', 'remove_order_downloads_from_emails', 10, 1 ); 
function remove_order_downloads_from_emails( $emails ){
remove_action( 'woocommerce_email_order_details', array( $emails, 'order_downloads' ), 10 );
}

Any help much appreciated.

Upvotes: 2

Views: 484

Answers (1)

LoicTheAztec
LoicTheAztec

Reputation: 254373

The following code will remove the downloads table section from Refunded order email notification:

add_action( 'woocommerce_email_order_details', 'remove_downloads_section_from_refunded_order_emails', 1, 4 );
function remove_downloads_section_from_refunded_order_emails( $order, $sent_to_admin, $plain_text, $email ){
    if( $email->id === 'customer_refunded_order' )
        remove_action( 'woocommerce_email_order_details', array( WC()->mailer(), 'order_downloads' ), 10 );
}

Code goes in function.php file of your active child theme (or active theme). Tested and works.

Upvotes: 3

Related Questions