10 Replies to “Change any WordPress WooCommerce Payment Gateway Icon”

  1. Hi, this is great however what if you wanted to remove the <img src markup that surrounds the filter contents in an aim to add font awesome icons. As I like to keep images to a minimum I would like to do this with all checkout icons. Any ideas?

  2. Hi David,

    Thanks for writing. I don’t use Font Awesome, but it’s just a matter of generating the proper HTML markup. Assuming you have Font Awesome already installed and working… simply replace the HTML with whatever markup you wish. This page shows the markup required to display the Font Awesome payment icons: fortawesome.github.io/Font-Awesome/icons/#payment

    So replace this:

    return '<img src="' . get_bloginfo('stylesheet_directory') . '/images/woocommerce-icons/cards.png" alt="Authorize.net" />';

    With something like this:

    return '<i class="fa fa-cc-visa"></i><i class="fa fa-cc-mastercard"></i>';

    Good luck and let me know how that works.

  3. Hi.

    Can you possibly tell me what my $id value would be for using PayPal or WorldPay as opposed to Authorize.

    Want to use the solution WooThemes sent you but it’s failing when I try:
    if ( $id === 'payment_method_paypal' ) {.

    1. Thanks for writing Elija. Your question is a bit off-topic from this posting. However, I’m not familiar enough with WooCommerce to know the answer anyway.

  4. hi, what if i want to do this with another 2 images?

    i did it with one payment gateway but i can’t put the image for the other ones

  5. For those who do not know how to change COD icon (Cash on Delivery icon) , do as follows:
    Copy and Paste the code bellow, to the “functions.php” file on your website theme:

    // Put an icon for COD Payment Gateway
    function woocommerce_cod_icon( $icon, $id ) {
    if ( $id === 'cod' ) {
    return '';
    } else {
    return $icon;
    }
    }
    add_filter( 'woocommerce_gateway_icon', 'woocommerce_cod_icon', 10, 2 );

    This took me 1-2 hours to find out the *** COD function name by crawling into woocommerce php files! so yes, it will save your life!

    Regards,
    kaladiar.com

Leave a Reply

Your email address will not be published. Required fields are marked *