Support » Plugin: Braintree for WooCommerce Payment Gateway » Show saved PayPal email address instead of tiny icon

  • Resolved nothin7



    I want to replace the tiny PayPal icon (representing a saved payment method) with the actual saved payment method email address:

    Can you add this as a feature request?

    In the meantime, is there a Javascript event that fires when this data has loaded so I can replace the element with the image’s title attribute?


Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Jesse Pearson


    Automattic Happiness Engineer

    @nothin7 Suggestions for updates can be added on the ideas board here:

    You can use this filter to edit the title that is passed:

    This is its context in the plugin itself:

    		 * Payment Gateway Payment Form Payment Method Title.
    		 * Filters the text/HTML rendered for a saved payment method, like "Amex ending in 6666".
    		 * @since 4.0.0
    		 * @param string $title
    		 * @param \SV_WC_Payment_Gateway_Payment_Token $token
    		 * @param \SV_WC_Payment_Gateway_Payment_Form $this payment form instance
    		return apply_filters( 'wc_' . $this->get_gateway()->get_id() . '_payment_form_payment_method_title', $title, $token, $this );

    Replacing this with a filter vs JS should be cleaner and easier.

    Thread Starter nothin7


    Thanks! Here’s a complete solution for others:

    // Change tiny PayPal image to user's email address in saved payment method
    function my_wc_braintree_paypal_payment_form_payment_method_title( $title ) {
    	preg_match( '/ alt="([^"]+)"/i', $title, $matches );
    	return $matches[1];
    add_filter( 'wc_braintree_paypal_payment_form_payment_method_title', 'my_wc_braintree_paypal_payment_form_payment_method_title' );
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show saved PayPal email address instead of tiny icon’ is closed to new replies.