Skip to content

Instantly share code, notes, and snippets.

@thetwopct
Last active December 5, 2022 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thetwopct/6b6935c213b0d5b85b8e8ea9dcf6ac12 to your computer and use it in GitHub Desktop.
Save thetwopct/6b6935c213b0d5b85b8e8ea9dcf6ac12 to your computer and use it in GitHub Desktop.
Translate Tax Toggle for WooCommerce
<?php // don't copy this opening PHP tag if you are pasting in to functions.php
/**
* Change text strings for WooCommerce Tax Toggle
*
* Translate the text used in Tax Toggle plugin.
* Copy the code below to your theme functions.php file.
*
* @param string $translated_text Translated text.
* @param string $text Text to translate.
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
*/
function wctax_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Excl.':
$translated_text = __( 'Exkl', 'wc-tax' );
break;
case 'From':
$translated_text = __( 'Von', 'wc-tax' );
break;
case 'Incl.':
$translated_text = __( 'Inkl', 'wc-tax' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'wctax_text_strings', 20, 3 );
@thetwopct
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment