WooCommerce: Change the PayPal Icon @ Checkout Page

A simple function for a very common issue: “I can’t find where to change the PayPal icon?”. If you have the same problem, here’s a quick PHP fix.

WooCommerce: how to change the PayPal icon on the checkout
WooCommerce: how to change the PayPal icon on the checkout

WooCommerce PHP Snippet: Change the PayPal Icon @ Checkout Page

Note: you can find official PayPal icons @ https://www.paypal.com/ie/webapps/mpp/logo-center

/**
 * @snippet       Change the PayPal Icon @ Checkout Page
 * @how-to        Watch tutorial @ https://businessbloomer.com/?p=19055
 * @author        Rodolfo Melogli
 * @compatible    WC 3.6.1
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */
 
add_filter( 'woocommerce_paypal_icon', 'bbloomer_replace_paypal_icon' );
 
function bbloomer_replace_paypal_icon() {
   return 'https://your_image_url';
}

Where to add this code?

You can place PHP snippets at the bottom of your child theme functions.php file (before "?>" if you have it). CSS, on the other hand, goes in your child theme style.css file. Make sure you know what you are doing when editing such delicate files - if you need more guidance, please take a look at my free WooCommerce Customization video tutorial.

Does this snippet still work?

Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting on PHP 7.

If you think this code saved you time & money, please join other Business Bloomer supporters and avail of 365 days of WooCommerce benefits. Thank you in advance :)

Need Help with WooCommerce?

Check out these free videos, tutorials and tips!

  • how-to-edit-woocommerce-with-php-snippets
  • woocommerce-hooks-add_action-list-visual
  • woocommerce-customize-single-product-page-PHP
  • woocommerce-customize-shop-page-PHP
  • woocommerce-advanced-customization
  • how-to-edit-woocommerce-cart
  • woocommerce-customize-checkout-page-PHP
  • woocommerce-email-customization
  • woocommerce-conditional-logic

Rodolfo Melogli

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as a WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.

28 thoughts on “WooCommerce: Change the PayPal Icon @ Checkout Page

  1. Actually, I run into the same issue as Sifat switching to Storefront as well. Here is what I get via inspecting page:

    <img src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-small.png" alt="PayPal/Venmo" scale="0">

    what page is the image source calling from so that instead of changing the filter (ie. add snippet in the functions) I can place/replace the code in the original file (ie.

    <img src="mysite/*/img.png>

    ); whereby allowing me to use the theme I would like to use with all of the other plugins active.

    Thank you in advance
    Respectfully

    1. Hey Nathan, please don’t edit core files – this filter is great as you don’t have to do that ๐Ÿ™‚

  2. I use this code but it’s not working . i tried localhost also live site not working .. can you please help me .?

    add_filter( ‘woocommerce_paypal_icon’, ‘bbloomer_replace_paypal_icon’,99);
    function bbloomer_replace_paypal_icon($iconUrl) {
    return ‘http://localhost/wp-1/wp-content/uploads/2019/01/—.jpg’;
    }

    1. Hello Sifat, thanks for your comment! I just tested this again with Storefront theme and it works perfectly. Maybe your theme (or another plugin) is messing/conflicting with my snippet?

      To troubleshoot, go to WP Dashboard > WooCommerce > System Status: what errors do you see in red font?

      Also, take a look at this tutorial to see how to troubleshoot: https://businessbloomer.com/woocommerce-troubleshooting-mistakes-to-avoid/

      Finally, can you try switching temporarily to “Twentyseventeen” or “Storefront” theme and let me know if it works?

      Hope this helps!

      R

  3. This is exactly what I added to my functions.php file but my cart still shows the standard PayPal icon.
    Any suggestions?

    1. Hey Paul! Are you working on the Cart or Checkout page?

    2. The checkout page.

    3. Hey Paul, it should work indeed. Can you try with another theme to see if it’s your current theme that is responsible for this error?

    4. I found out that my theme already was adding a filter to this hook and therefore was overriding my attempt to change the icon.
      By adding a high priority (e.g 99) to my filter it worked nice.

      add_filter( 'woocommerce_paypal_icon', 'bbloomer_replace_paypal_icon',99);

      So, try to add 99 at the end and see what happens!

      Good luck!

    5. Nice, thank you ๐Ÿ™‚

  4. I really appreciate the help you have provided but this snippet doesn’t seem to be working for me.

    1. Hey Paul, thanks for your comment! I just tested this on Woo 3.2.5 and Storefront and still works perfectly ๐Ÿ™‚

  5. Hi Rodolfo, your WC tutorials are the most helpful I’ve found in a long time, so thank you so much for sharing!

    I have a question, is it possible to add a custom icon/logo to the COD payment method? Been searching with no luck ๐Ÿ™‚

    1. Thanks Maira ๐Ÿ™‚ Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R

  6. thanks a lot, it works prefectly

  7. This code is not working for me could please helm me..?

    1. Hey Mounish, thanks for your comment! What image URL are you using in your snippet?

  8. Hi, Thank you for this snippet.

    It works perfectly. However, the logo I have is 159×55 but for some reason is displaying at 150×52 so looks slightly blurred.

    I note you say this can be altered by CSS but as the image is being pulled from PayPal’s website I am not sure what to add to my style.css to make the necessary adjustments.

    As an addition to the above, one concern I have is that if PayPay decide to change the image size will I need to update the CSS to reflect this or is there a way of showing the logo at the intended size automatically?

    Thanks in advance.

    1. Cheers Bri ๐Ÿ™‚ In relation to your other questions, it’s difficult for me to give you an answer re: CSS without having your website checkout link. Also, if PayPal changes the image, yep, this will appear broken on your checkout. You can always download such image into your media library instead and avoid linking to PayPal in case! Hope this helps

  9. Hi thank you how do you change the size of the image

    1. Hey Chilly, thanks so much for your comment! Image size can be changed via simple CSS, are you familiar with that?

  10. very nice man, how to set cash on delivery using any images….could you help me….

    1. You’re welcome Siva! For “cod”, you can use this:

      
      // Change COD icon
      
      function replaceCODicon($iconUrl) {
      	return 'http://img.jpg'; // change this to your IMAGE URL
      }
       
      add_filter('woocommerce_cod_icon', 'replaceCODicon');
      
      

      Let me know ๐Ÿ™‚

  11. I was so relieved to find this filter. I should’ve known it was you who created it! ๐Ÿ™‚ Thank you AGAIN for your fantastic contributions, Rodolfo. You make my life a whole lot easier.

    1. Thank you Sharon for your amazing feedback ๐Ÿ™‚

  12. Hi. Thanks for the article, it’s really helpful! Is there a way to also return the link text “about paypal” that lies right beside the icon?

    1. Thank you Adriano. In relation to “about paypal” just take a look at the PayPal gateway file and see if there is a filter or hook to change that… otherwise you could hide that via CSS.

Questions? Feedback? Support? Leave your Comment Now!
_____

If you are writing code, please wrap it between: [php]code_here[/php]. Failure to complying with this (as well as going off topic) will result in comment deletion. You should expect a reply in about a week - this is a popular blog but I need to get paid work done first. Please consider joining #BloomerArmada to ask me 1-to-1 WooCommerce questions. Thank you :)

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.