Change “Additional Information” text in WooCommerce checkout using special characters

Viewed 625

I am was looking to change the title of the additional information tab in WooCommerce checkout page. I ran across this code that worked initially but when I entered special characters (it's a site in a different language - š,ā,ņ etc) it didn't work.

Do you know a solution for this? The code that worked before is located in:
Change title "Additional Information" in woocommerce

  // Hook in
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );

// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields( $fields ) {
     $fields['order']['order_comments']['placeholder'] = 'Please type your PO number here and we will add it to the invoice.';
     $fields['order']['order_comments']['label'] = '';
     return $fields;
}

Any help?

1 Answers

The following code, using dedicated gettext hook, targeting checkout page, will allow you to change “Additional Information” text using special characters:

add_filter( 'gettext', 'change_some_woocommerce_strings', 10, 3 );
function change_some_woocommerce_strings( $translate_text, $original_text, $domain ) {
    if ( is_checkout() && $original_text === 'Additional information' ) {
        $translate_text = 'š,ā,ņ š,ā,ņ š,ā,ņ š,ā,ņ';
    }

    return $translate_text;
}

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

Related