Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1232459

    Hi,
    I’m trying to modify “Proceed with PayPal” button text.
    I added this function found everywhere on the web and which seems to work for many people:

    add_filter( 'gettext', 'custom_paypal_button_text', 20, 3 );
     
    function custom_paypal_button_text( $translated_text, $text, $domain ) {
     
    	if( $translated_text == 'Proceed to PayPal' ) {
    		$translated_text = 'Payerthgy'; // new button text is here
    	}
     
    	return $translated_text;
    }

    …but it doesn’t work for me and I think there’s something to do with the theme.
    Any idea?
    If needed, you can find a link and credentials to my website in private content.
    Thanks a lot!

    #1233436

    Hey fcp,

    Your Paypal checkout buttons says Payer avec PayPal, did you try adding that text instead of Proceed to PayPal in the code example?

    Best regards,
    Rikard

    #1233460

    Try this:

    function my_text_strings( $translated_text, $text, $domain ){
    switch ( $translated_text ){
        case 'Proceed to PayPal':  $translated_text = __( 'Payerthgy', $domain );
        break;
      }
      return $translated_text;
    }
    add_filter('gettext', 'my_text_strings', 20, 3);

    PS: the position of add_filter is not important – i notice it always this way in my child-theme functions.php because it provides a clearer conclusion to the above function

    PPS: if you have to translate more than one string – it always have to be case 1 …; break; case 2 , break;
    after each string translation there had to be a break.

    • This reply was modified 4 years, 3 months ago by Guenni007.
    #1233608

    Hi Rikard,
    I need to add the text “Payer” instead of “Proceed to PayPal”.

    #1233609

    Hi Guenni,
    Thanks for your reply.
    I’m sorry but this code doesn’t work neither for me :-(

    #1233666

    The above code has been tested on many strings and should work; of course, the first string “Proceed to PayPal” may not be in your source code. It would be enough if the spaces were represented by characters, or e.g. there is Paypal instead of PayPal.
    Which plugin do you use for your payment systems.

    Try this:

    function my_text_strings( $translated_text, $text, $domain ) {
    	switch ( $translated_text ) {
    		case 'Proceed to PayPal' :
    			$translated_text = __( 'Payerthgy', 'woocommerce' );
    			break;
    	}
    	return $translated_text;
    }
    add_filter( 'gettext', 'my_text_strings', 20, 3 );

    On woocommerce there are some filter for different buttons ( woocommerce_order_button_text or woocommerce_order_button_html)
    is it the checkout button ?

    Best would be
    if i can see the page it concerns.

    #1233668

    and if it is the woocommerce you use the part where it is handled is:
    woocommerce – includes – gateways – paypal: “class-wc-gateway-paypal.php” about line 44:
    $this->order_button_text = __( 'Proceed to PayPal', 'woocommerce' );

    but try first the above! it is more specific on paypal – this below changes the order_button_text on all instances)

    so this could be ok too : –

    function my_order_button_text() {
        return __( 'Payerthgy', 'woocommerce' ); 
    }
    add_filter( 'woocommerce_order_button_text', 'my_order_button_text' ); 
    #1233810

    Hi Guenni,

    Both functions don’t work :-(
    Yes, it is the checkout button.

    I checked woocommerce / includes / gateways / paypal / “class-wc-gateway-paypal.php” about line 44 and the text IS “Proceed to PayPal”:

    View post on imgur.com


    I also checked wp-content / languages / plugins / “woocommerce-fr_FR.po” and the text IS also “Proceed to PayPal”:

    View post on imgur.com

    I use Stripe plugin for my payments by credit card, but no plugin for PayPal. It is included in WooCommerce.

    #1234665

    Hi,
    Sorry for the late reply, is this the button you are trying to change?
    2020-08-02_132230.png
    Thanks to @Guenni007 for the function, I modified it a little to find the button text “Payer avec PayPal” and it seems to work now.

    function my_text_strings( $translated_text, $text, $domain ){
    switch ( $translated_text ){
        case 'Payer avec PayPal':  $translated_text = __( 'Payerthgy', $domain );
        break;
      }
      return $translated_text;
    }
    add_filter('gettext', 'my_text_strings', 20, 3);

    2020-08-02_132900.png
    Please clear your browser cache and check.

    Best regards,
    Mike

    #1239629

    Hi Mike,
    Thanks for your reply.
    As usual, your function works like a charm.
    Thanks a lot for your help guys! ;-)

    #1239641

    Hi,

    I’m glad this was resolve for you. If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Modify "Proceed with PayPal" button text on WooCommerce’ is closed to new replies.