I'm trying to change the text in the 'Place order' button on my multilingual site in WooCommerce. My default lang is English US, other is Polish. I can easily modify the secondary language text via my WPML plugin, but I cannot change the default language. I tried modifying the button text via a JS code which worked in the default EN page, but the Polish one started to display the new English text too. I also tried using Loco and adding English as a language, changed the English text - but that didn't work. How is this doable - to change text strings in default language and making them translatable via WPML in the same time?
I'm trying to change the text in the 'Place order' button on my multilingual site in WooCommerce. My default lang is English US, other is Polish. I can easily modify the secondary language text via my WPML plugin, but I cannot change the default language. I tried modifying the button text via a JS code which worked in the default EN page, but the Polish one started to display the new English text too. I also tried using Loco and adding English as a language, changed the English text - but that didn't work. How is this doable - to change text strings in default language and making them translatable via WPML in the same time?
You could use their filter to do this:
/* Add to the functions.php file of your theme */
add_filter( 'woocommerce_order_button_text', 'woo_custom_order_button_text' );
function woo_custom_order_button_text() {
return __( 'Your new button text here', 'woocommerce' );
}
If you have static texts, which are hard-coded in the PHP, you can just use GetText calls, like:
<?php __('Hello world','cool_theme'); ?>
WPML hooks to the GetText calls and makes these texts translatable via the String Translation interface. Please note that this method only works for texts that cannot be edited and are fixed in the theme.