Search code examples
phpwordpresstemplateswoocommerceemail-notifications

How to change "Product" to "Service" in new order WooCommerce email notification


My request sounds easy, but I'm not able to configure it. I want to change the word "product" in the new order email the customers received to "service".. as we are offering services, not products.

I downloaded a plugin called "Say What?" but I should get the exact text domain, which I did not find.

I tried too apply the following filter but it did not work too

add_filter( 'admin-new-order', '__return_false' );
 
function my_text_strings( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
        case 'PRODUCT' :
            $translated_text = __( 'SERVICE', 'woocommerce' );
            break;
    }
    return $translated_text;
}
add_filter( 'gettext', 'my_text_strings', 20, 3 );

enter image description here


Solution

  • Have a look at emails/email-order-details.php template file, line 42

    • This template can be overridden by copying it to yourtheme/woocommerce/emails/email-order-details.php.

    Replace

    <th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>
    

    With

    <th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Service', 'woocommerce' ); ?></th>