• Hello. I have been trying hard to change the “Continue” text in my shopping card before one is redirected to a Stripe self hosted gateway. The e-shop I am working on will not be in english. I tried some PHP snippets, CSS change and looked for translation strings via Loco translate but without any luck. This issue appears only for a card payment method. For a wire transfer method the button is displayed correctly with a correct text.

    How can I change the button text please? Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Sean Conklin

    (@seanconklin)

    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.

    Plugin Author Sean Conklin

    (@seanconklin)

    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.

    Thread Starter jjonek

    (@jjonek)

    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.