Hi @jjonek
Thanks for bringing this to my attention. I have reproduced this problem and am working on a fix. It’s a little tricky since the Block based checkout uses JavaScript to render the translations, typically from JSON files. I’m examining how to apply WordPress’s PHP translation filters to it, if possible.
If you need a dirty hack to get you by for the meantime, you can use JavaScript to change it after it loads. Here’s a PHP Code Snippet for that:
<?php
add_action( 'template_redirect', function() {
if( ! class_exists( 'WooCommerce' ) || ! is_checkout() ) {
return;
}
add_action( 'wp_print_footer_scripts', function() {
?>
<script type="text/javascript">
document.addEventListener( 'DOMContentLoaded', function() {
let checkoutBlockInterval = setInterval( function() {
let placeOrderButton = '.wc-block-components-checkout-place-order-button__text';
if( document.querySelector( placeOrderButton ) ) {
document.querySelector( placeOrderButton ).innerHTML = 'TEST';
clearInterval( checkoutBlockInterval );
}
}, 500 );
} );
</script>
<?php
} );
} );
Thread Starter
jjonek
(@jjonek)
Thank you so much @seanconklin
PHP Code Snippet worked 🎉
Thread Starter
jjonek
(@jjonek)
Should I make this as resolved or would you do yourself once you do the proper fix?
I appreciate your help.
Glad to hear that works for your needs 🙂
I’ll mark this resolved once I’ve figured out whether the Checkout Block translations (i18n, gettext) can be made to work with PHP filters. It shouldn’t take too long to narrow that down. I’ve already spent an hour or so investigating it, but with the newer Block based technology things are significantly more involved than they used to be.