Skip to content

Instantly share code, notes, and snippets.

@thetwopct

thetwopct/functions.php

Last active May 14, 2021
Embed
What would you like to do?
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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment