Support » Plugin: WooCommerce Square » hot to change “Place order” text?

  • Resolved taak7

    (@taak7)


    I tried some filters to change order button text “Place order” to Japanese.

    • gettext
    • woocommerce_order_button_html
    • woocommerce_order_button_text
    • wc_payment_gateway_square_credit_card_order_button_text

    but doesn’t work.
    how can you do that?

    • This topic was modified 2 years, 6 months ago by taak7.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Yuki K. a11n

    (@yukikatayama)

    Automattic Happiness Engineer

    A workaround without going into the code would be to use a free translation plugin like Loco Translate (https://wordpress.org/plugins/loco-translate/). This will allow you translate the WooCommerce plugin, find the phrases and change it to be what you’d like. I’d also recommend clearing cache after making the change in case it does not immediately show.

    Thread Starter taak7

    (@taak7)

    hi @yukikatayama, thanks for your response.

    i tried to use the plugin, but i couldn’t find the text domain “woocommerce-plugin-framework”.
    could you tell me if know about this?

    I tried “gettext” filter like this.

    add_filter('gettext', 'custom_text', 100, 3);
    function custom_text($translation, $text, $domain) {
      return 'ABC';
    }

    almost all text was changed but “Place order” was still alive…
    can you change with Loco Translate even this situation?

    By the way, I found the way to change the text!!!

    add_filter ('woocommerce_order_button_html', 'custom_order_button_html', 100);
    function custom_order_button_html($button_html) {
    
      $button_html = str_replace('id="place_order"', 'id="place_order2"', $button_html);
    
      return $button_html;
    }

    but i’m afraid of that changing id may trigger some trouble…
    does anybody have better way?

    thanks.

    Thread Starter taak7

    (@taak7)

    It worked with plugin “Booster”.

    thanks.

    Thread Starter taak7

    (@taak7)

    And i found another way without plugin.

    add_filter('woocommerce_available_payment_gateways', 'custom_available_payment_gateways', 100);
    function custom_available_payment_gateways($payment) {
      $payment['square_credit_card']->order_button_text = 'ABC';
    }

    thanks.

    Where in the booster plugin can you edit the Place Order text?

    Here’s the proper hook to change the text on the button that says “Place Order.”replace “Pay for order” with whatever you want the button to say.

    add_filter( ‘woocommerce_order_button_text’, ‘misha_custom_button_text’ );

    function misha_custom_button_text( $button_text ) {
    return ‘Pay For Order’; // new text is here
    }

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘hot to change “Place order” text?’ is closed to new replies.