Created
February 16, 2019 09:18
-
-
Save shirokoweb/357252ecb42de501c42918941c759423 to your computer and use it in GitHub Desktop.
Translate a String in WooCommerce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'gettext', 'webplus_translate_woocommerce_strings', 999 ); | |
function webplus_translate_woocommerce_strings( $translated ) { | |
// Store all string in an array | |
$translatedStrings = array( | |
'Sale!' => 'ON OFFER', | |
'Product Description' => 'Product Specifications', | |
); | |
$translated = str_ireplace( array_keys($translatedStrings), $translatedStrings, $translated ); | |
return $translated; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment