skip to Main Content

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

2

Answers


  1. 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>
    
    Login or Signup to reply.
  2. function nishant_wc_translations($translated){
        $text = array(
        'Product' => 'Service',
        'Products' => 'Services',
        );
        $translated = str_ireplace(  array_keys($text),  $text,  $translated );
        return $translated;
    }
    

    add this in functions.php

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search