Reputation: 31
I have a question about changing text of place_order.
Check out page will reload form by update_checkout Event, So the place_order text will change back to original text ‘proceed to Paypal’.
I've tried to use Jquery and function hook to change text but still change back.
function woo_custom_order_button_text() { return __( 'Your new button text here', 'woocommerce' ); }
How can I change the text of #place_order by not disable the update_checkout Event?
Upvotes: 3
Views: 1568
Reputation: 253784
To change the place order button text when Paypal is the chosen payment gateway use the following:
add_filter( 'gettext', 'change_checkout_paypal_pay_button_text', 10, 3 );
function change_checkout_paypal_pay_button_text( $translated_text, $text, $domain ) {
if( 'Proceed to PayPal' === $text ) {
$translated_text = __('Your custom text', $domain); // <== Here the replacement txt
}
return $translated_text;
}
Code goes in functions.php file of your active child theme (or active theme). Tested and works.
Now to change the place order text for others payment gateways, you will use in addition the following:
add_filter( 'woocommerce_order_button_text', 'custom_checkout_place_order_text' );
function custom_checkout_place_order_text( $button_text ) {
return __( 'Your custom text here', 'woocommerce' ); // <== custom text Here
}
Code goes in functions.php file of your active child theme (or active theme). Tested and works.
Upvotes: 2