0

I would like to edit the additional content for specific WooCommerce emails. Is there any hook filter to do this?

I have just managed to change the Heading text with a filter woocommerce_email_heading_customer_completed_order.

I would also like to do this for the additional content.

enter image description here

Vincenzo Di Gaetano
  • 3,892
  • 3
  • 13
  • 32
stemon
  • 599
  • 1
  • 5
  • 23

1 Answers1

3

You can use the 'woocommerce_email_additional_content_' . $this->id.

Here you find a complete list of email ids.

So in your case:

  • woocommerce_email_additional_content_customer_refunded_order for full refund
  • woocommerce_email_additional_content_customer_partially_refunded_order for partial refund

Try this:

// edit the additional content of the "Refunded order" email
add_filter( 'woocommerce_email_additional_content_customer_refunded_order', 'custom_additional_content_customer_refunded_order', 99, 3 );
add_filter( 'woocommerce_email_additional_content_customer_partially_refunded_order', 'custom_additional_content_customer_refunded_order', 99, 3 );
function custom_additional_content_customer_refunded_order( $content, $object, $email ) {
    $content = 'Your personalized additional content';
    return $content;
}

The code has been tested and works. Add it to your active theme's functions.php.

Vincenzo Di Gaetano
  • 3,892
  • 3
  • 13
  • 32
  • Thanks. And thanks for the links also. Now I have a good understanding of how it works. Unfortunatelly, some people voted the question down as they could not understand it. You are brilliant – stemon Apr 12 '21 at 16:53