Viewing 6 replies - 1 through 6 (of 6 total)
  • For the PayPal payment gateway, some icons are used;
    most of which are linked from official PayPal site acording to the website’s country of origin:

    https://www.paypalobjects.com/webstatic/mktg/logo/AM_mc_vs_dc_ae.jpg
    https://www.paypalobjects.com/es_XC/Marketing/i/banner/paypal_debit_card_275x60.gif
    https://www.paypalobjects.com/webstatic/en_TW/mktg/logos/AM_mc_vs_dc_ae.jpg
    https://www.paypalobjects.com/webstatic/ru_RU/mktg/business/pages/logo-center/AM_mc_vs_dc_ae.jpg

    otherwise it uses the logo provided in the directory:
    ..woocommerce/includes/gateways/paypal/assets/images/paypal.png

    Maybe you can edit those lines…

    Thread Starter atrixdave

    (@atrixdave)

    Thanks for the reply Manus! My site is showing this one:

    https://www.paypalobjects.com/webstatic/mktg/logo/AM_mc_vs_dc_ae.jpg

    Obviously I cannot change the image that’s hosted on paypalobjects.com…do you know what code I would need to edit to change this image on my site?

    Try looking at
    …./woocommerce/includes/gateways/paypal/class-wc-gateway-paypal.php

    There is a

    public function get_icon()

    function inside where it takes those links for the icons…

    Thread Starter atrixdave

    (@atrixdave)

    Thank you! This is what I was looking for! Now I’m trying to override this file within my child theme, but its not working. Do you know if its possible to override includes files within a child theme? Otherwise how could I change these files without editing the core files?

    Thread Starter atrixdave

    (@atrixdave)

    Or could I add this to the functions.php file in my child theme?

    /**
    	 * get_icon function.
    	 *
    	 * @return string
    	 */
    	public function get_icon() {
    		$link = null;
    		switch ( WC()->countries->get_base_country() ) {
    			case 'US' :
    			case 'NZ' :
    			case 'CZ' :
    			case 'HU' :
    			case 'MY' :
    				$icon = 'https://www.paypalobjects.com/webstatic/mktg/logo/AM_mc_vs_dc_ae.jpg';
    			break;
    			case 'TR' :
    				$icon = 'https://www.paypalobjects.com/webstatic/mktg/logo-center/logo_paypal_odeme_secenekleri.jpg';
    			break;
    			case 'GB' :
    				$icon = 'https://www.paypalobjects.com/webstatic/mktg/Logo/AM_mc_vs_ms_ae_UK.png';
    			break;
    			case 'MX' :
    				$icon = array(
    					'https://www.paypal.com/es_XC/Marketing/i/banner/paypal_visa_mastercard_amex.png',
    					'https://www.paypal.com/es_XC/Marketing/i/banner/paypal_debit_card_275x60.gif'
    				);
    				$link = 'https://www.paypal.com/mx/cgi-bin/webscr?cmd=xpt/Marketing/general/WIPaypal-outside';
    			break;
    			case 'FR' :
    				$icon = 'https://www.paypalobjects.com/webstatic/mktg/logo-center/logo_paypal_moyens_paiement_fr.jpg';
    			break;
    			case 'AU' :
    				$icon = 'https://www.paypalobjects.com/webstatic/en_AU/mktg/logo/Solutions-graphics-1-184x80.jpg';
    			break;
    			case 'DK' :
    				$icon = 'https://www.paypalobjects.com/webstatic/mktg/logo-center/logo_PayPal_betalingsmuligheder_dk.jpg';
    			break;
    			case 'RU' :
    				$icon = 'https://www.paypalobjects.com/webstatic/ru_RU/mktg/business/pages/logo-center/AM_mc_vs_dc_ae.jpg';
    			break;
    			case 'NO' :
    				$icon = 'https://www.paypalobjects.com/webstatic/mktg/logo-center/banner_pl_just_pp_319x110.jpg';
    			break;
    			case 'CA' :
    				$icon = 'https://www.paypalobjects.com/webstatic/en_CA/mktg/logo-image/AM_mc_vs_dc_ae.jpg';
    			break;
    			case 'HK' :
    				$icon = 'https://www.paypalobjects.com/webstatic/en_HK/mktg/logo/AM_mc_vs_dc_ae.jpg';
    			break;
    			case 'SG' :
    				$icon = 'https://www.paypalobjects.com/webstatic/en_SG/mktg/Logos/AM_mc_vs_dc_ae.jpg';
    			break;
    			case 'TW' :
    				$icon = 'https://www.paypalobjects.com/webstatic/en_TW/mktg/logos/AM_mc_vs_dc_ae.jpg';
    			break;
    			case 'TH' :
    				$icon = 'https://www.paypalobjects.com/webstatic/en_TH/mktg/Logos/AM_mc_vs_dc_ae.jpg';
    			break;
    			default :
    				$icon = WC_HTTPS::force_https_url( WC()->plugin_url() . '/includes/gateways/paypal/assets/images/paypal.png' );
    				$link = null;
    			break;
    		}
    
    		if ( is_null( $link ) ) {
    			$link = 'https://www.paypal.com/' . strtolower( WC()->countries->get_base_country() ) . '/webapps/mpp/paypal-popup';
    		}
    
    		if ( is_array( $icon ) ) {
    			$icon_html = '';
    			foreach ( $icon as $i ) {
    				$icon_html .= '<img src="' . esc_attr( $i ) . '" alt="PayPal Acceptance Mark" />';
    			}
    		} else {
    			$icon_html = '<img src="' . esc_attr( apply_filters( 'woocommerce_paypal_icon', $icon ) ) . '" alt="PayPal Acceptance Mark" />';
    		}
    
    		if ( $link ) {
    			$what_is_paypal = sprintf( '<a href="%1$s" class="about_paypal" onclick="javascript:window.open(\'%1$s\',\'WIPaypal\',\'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=1060, height=700\'); return false;" title="' . esc_attr__( 'What is PayPal?', 'woocommerce' ) . '">' . esc_attr__( 'What is PayPal?', 'woocommerce' ) . '</a>', esc_url( $link ) );
    		} else {
    			$what_is_paypal = '';
    		}
    
    		return apply_filters( 'woocommerce_gateway_icon', $icon_html . $what_is_paypal, $this->id );
    	}

    This is what we need to solve this issue. Hope it will help someone:

    function newPayment_gateway_icon( $icon, $id ) {
        if ( $id === 'paypal' ) {
            return '<img src="' . get_stylesheet_directory_uri() . '/images/paypal.png" alt="PayPal" />';
        } else {
            return $icon;
        }
    }
    add_filter( 'woocommerce_gateway_icon', 'newPayment_gateway_icon', 10, 2 );
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Remove/change "PayPal Acceptance Mark" on PayPal Checkout (Woo v2.2.5)’ is closed to new replies.