Woocommerce terms and conditions checkbox text translation code does not work

Hello,

After updating pro theme to the latest version my code in child theme functions.php does not work anymore to translate woocommerce terms and conditions checkbox text.

The code, which worked before the update:

// =============================================================================
add_filter(‘gettext’, ‘translate_texts’);
function translate_texts($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;
}
// =============================================================================

Probably in the latest updates you changed some keywords?

Regards,

Lukas

Hi There @lukasjan

Thanks for writing in! Could you please try adding the following code into your child theme’s functions.php and see if that helps.

//Customise Terms & Conditions box add_filter('gettext', 'x_translated_text' ); function x_translated_text($translated) { $your_translation = "Insert your translation here"; $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>', $your_translation, $translated); return $translated; }

If that does not help, provide us with the link to the page to check.

Let us know how it goes.
Thanks!

Hello,

Thanks for your response.

This code did not change the string:

//Customise Terms & Conditions box 
add_filter('gettext', 'translate_texts');
function translate_texts($translated) { 
	$translated = str_ireplace('I have read and agree to the website <a href="%s" target="_blank" class="woocommerce-terms-and-conditions-link">terms and 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);
	return $translated; 
}
//Customise Terms & Conditions box 

Link to the store: https://www.mhealth.lt/parduotuve/

Link to the checkout: https://www.mhealth.lt/atsiskaitymas/

Lukas

Hi lukasjan,

Please back up your website completely and update manually the theme to version 6.1 and the Cornerstone to 3.1. You can find the file on your dashboard as it is still not available in the automatic updates.

kindly get back to us with the result of the steps above and URL/User/Pass of your WordPress dashboard using the Secure Note functionality of the post to follow up the case if you still have problems.

Thank you.

Thanks, it works now.

You’re welcome!

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