Terms and Conditions text

Hi. Is there an update to these two snippets below? I cant seem to get either working in child/ functions.php. Im using themeco’s custom field editor addon. Could this be affecting it?

The translation i need is simple “Please agree to our terms
Cheers

Snippet 1:

//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’ve read and accept the terms & conditions’, $your_translation, $translated);
return $translated;
}

Snippet 2:

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

Hi gimmechefs,

Thanks for reaching out.

There is no update on the code you given below. But it seems that you want to change the Terms & Condition text, and which can be changed from Appearance > Customize > WooCommerce > Checkout > Terms and conditions.

Alternatively, you can try the below code adding into your child theme.

add_filter('gettext', 'translate_texts' );
add_filter('gettext', 'rd_translate_tc');
add_filter('ngettext', 'rd_translate_tc');
function translate_texts($translated) 
{	
    $translated = str_ireplace('I have read and agree to the website ', 'Perskaičiau ir sutinku su ', $translated);
    return $translated;
}
function rd_translate_tc($translated) 
{
    $translated = str_ireplace('terms and conditions', 'sąlygomis ir taisyklėmis', $translated);
    return $translated;
} 

Remember that the above code will work if copied as it is and don’t conflict with any existing style.
Please note that the code provided serves only as a guide to help you get started custom coding on your own if there’s no option offered in our theme or the products we bundle.
We do not provide support for custom codes that means we can’t fix it in case it conflicts with something in your site nor will we enhance it.

Hope it helps.

Hi. Thanks for that. I didnt come accross the settings in customizer/woo.

That works fine.

Cheers

Hi @gimmechefs,

We are glad that it is now working on your end. If you have any other concerns, feel free to reach us.

Thank you.

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