Woocommerce I've read and accept the terms and conditions translate

Hello,

Function below does not work after new woocommerce and Pro updates

add_filter(‘gettext’, ‘x_translate_text1’ );
function x_translate_text1($translated) {
$translated = str_ireplace(‘I’ve read and accept the terms & conditions’, ‘Perskaičiau ir sutinku su sąlygomis ir taisyklėmis’, $translated);
return $translated;
}

I’ve also tried this but it crashed my website

// Translate texts
// =============================================================================
function translate_texts($translated) {
$translated = str_ireplace(‘I’ve read and accept the <a href="%s" "
"class=“woocommerce-terms-and-conditions-link”>terms & conditions’, ‘insert your translation here’, $translated);$translated);

return $translated;
}
add_filter(‘gettext’, ‘translate_texts’ );
// =============================================================================

How do I translate I’ve read and accept the terms and conditions in woocommerce checkout?

Summary

Website:
http://www.mhealth.lt/parduotuve

Hello There,

Thanks for writing in! Your code is no longer working because it does not have the correct keyword. Please make use of this code instead:

// Translate texts
// =============================================================================
function translate_texts($translated) { 
	$translated = str_ireplace('I&rsquo;ve read and accept the <a href=\"%s\" target=\"_blank\" ""class=\"woocommerce-terms-and-conditions-link\">terms &amp; conditions</a>', 'Perskaičiau ir sutinku su <a href=\"%s\" target=\"_blank\" ""class=\"woocommerce-terms-and-conditions-link\">sąlygomis ir taisyklėmis</a>', $translated);$translated);
	return $translated; 
}
add_filter('gettext', 'translate_texts' );
// =============================================================================

Please be very careful with the quotes to avoid PHP fatal error.

Please let us know how it goes.

Thank you for response.

Did not work, this code crashed the site as well.

My woocommerce ver. 3.2.1
Pro theme ver. 1.2.3

Hello There,

You may have inserted incorrect quotes. There are times that Windows or Mac will change the quotes as you copy and paste it. Would you mind providing us the ftp login credentials so we can take a closer look and fix this issue once and for all?

To do this, you can make a post with the following info:

  • FTP Hostname
  • FTP Username
  • FTP Password

Thank you.

Hello,

Checked the code and removed excess “/” symbols

Now code works, thank you.

Glad it’s okay now and thanks for sharing!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.