I need to translate the products, cart, and checkout.
I tried to add custom code to functions.php but this error popped out:
“Unable to communicate back with the site to check for fatal errors, so the PHP change was reverted. You will need to upload your PHP file change by some other means, such as by using SFTP.”
This is the code I imported:
add\_filter( ‘gettext’, ‘ahirwp\_translate\_woocommerce\_strings’, 999, 3 );
function ahirwp\_translate\_woocommerce\_strings( $translated, $untranslated, $domain ) {
if ( ! is\_admin() && ‘woocommerce’ === $domain ) {
switch ( $translated ) {
case ‘Sale!’:
$translated = ‘On Offer’;
break;
case ‘Description’:
$translated = ‘Product Specifications’;
break;
// ETC
}
}
return $translated;
}
If you know a simpler solution please help me…
[ad_2]