Created
July 21, 2014 17:00
-
-
Save claudiosanches/9db17583210a769f08b5 to your computer and use it in GitHub Desktop.
WooCommerce - Custom gateway icons
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add custom gateway icons | |
* | |
* @param string $icon Image HTML. | |
* @param string $gateway_id Gateway ID. | |
* | |
* @return string | |
*/ | |
function custom_wc_gateway_icons( $icon, $gateway_id ) { | |
// Example for PayPal: | |
if ( 'paypal' == $gateway_id ) { | |
$icon = '<img src="' . WC_HTTPS::force_https_url( 'http://your-site.com/image.png' ) . '" alt="' . __( 'PayPal' ) . '" />' | |
} | |
return $icon; | |
} | |
add_filter( 'woocommerce_gateway_icon', 'custom_wc_gateway_icons', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello Claudio,
i wanted to ask you something.
This is a part of the Code for my custom Payment Gateway:
How do i add a custom icon to my custom payment gateway?
Ive understood to replace to replace the URL...but i dont get how to add the gateway_id or which one i have to add....what do i have to do exactly?
Thanks...