• Resolved simonhunter

    (@simonhunter-1)


    We are trying to change the “Place order” text on the checkout page.

    We are using the following code to change the text:

    /* 
     * Change 'Place Order' on checkout page
     */ 
    add_filter( 'woocommerce_order_button_text', 'woo_custom_order_button_text' ); 
    function woo_custom_order_button_text() { 
    	return 'Start Subscription'; 
    }

    I can see that the text is added to the button in a ‘data-value’ attribute, but an Ajax call is overriding that and setting a ‘value’ attribute back to ‘Place Order’. Is there an easy around this without modifying WC core files?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Your code worked for me for the BACS and Cheque payment methods but failed for PayPal, so it does seem to be payment gateway dependant. What payment gateway are you using?

    I was able to change the text on all 3 of my payment gateway buttons using Loco Translate.

    To change almost any text, you can “translate” it. “Translate” in this context also means using different words in the same language.

    So try Loco Translate:
    https://www.ads-software.com/plugins/loco-translate/
    Activate, then:
    Dashboard > Loco Translate > Plugins > WooCommerce > select your language > Edit

    If you have theme override templates, look at
    Dashboard > Loco Translate > Themes > your-theme-name > etc

    In either case, click the Sync button, then filter for the string you want to change.

    Save in the custom location to make your translations update-safe:
    https://localise.biz/wordpress/plugin/manual/msginit#locations

    Thread Starter simonhunter

    (@simonhunter-1)

    Thanks @lorro.

    I am using the Authorize.net gateway.

    I ended up inserting the following script to override it after everything has loaded:

    jQuery(window).load(function() {
     jQuery('#place_order').attr('value', 'Start Subscription');
    });
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Place Order button text translation is overridden by Ajax’ is closed to new replies.