WC_Gateway_Paypal::get_icon_url()protectedWC 1.0

Get the link for an icon based on country.

Method of the class: WC_Gateway_Paypal{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_icon_url( $country );
$country(string) (required)
Country two letter code.

WC_Gateway_Paypal::get_icon_url() code WC 8.6.1

protected function get_icon_url( $country ) {
	$url           = 'https://www.paypal.com/' . strtolower( $country );
	$home_counties = array( 'BE', 'CZ', 'DK', 'HU', 'IT', 'JP', 'NL', 'NO', 'ES', 'SE', 'TR', 'IN' );
	$countries     = array( 'DZ', 'AU', 'BH', 'BQ', 'BW', 'CA', 'CN', 'CW', 'FI', 'FR', 'DE', 'GR', 'HK', 'ID', 'JO', 'KE', 'KW', 'LU', 'MY', 'MA', 'OM', 'PH', 'PL', 'PT', 'QA', 'IE', 'RU', 'BL', 'SX', 'MF', 'SA', 'SG', 'SK', 'KR', 'SS', 'TW', 'TH', 'AE', 'GB', 'US', 'VN' );

	if ( in_array( $country, $home_counties, true ) ) {
		return $url . '/webapps/mpp/home';
	} elseif ( in_array( $country, $countries, true ) ) {
		return $url . '/webapps/mpp/paypal-popup';
	} else {
		return $url . '/cgi-bin/webscr?cmd=xpt/Marketing/general/WIPaypal-outside';
	}
}