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        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WC 3.6.1
 * @community     https://businessbloomer.com/club/
 */
 
add_filter( 'woocommerce_paypal_icon', 'bbloomer_replace_paypal_icon' );
 
function bbloomer_replace_paypal_icon() {
   return 'https://your_image_url';
}

Where to add custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

  • WooCommerce: Cart and Checkout on the Same Page
    This is your ultimate guide – complete with shortcodes, snippets and workarounds – to completely skip the Cart page and have both cart table and checkout form on the same (Checkout) page. But first… why’d you want to do this? Well, if you sell high ticket products (i.e. on average, you sell no more than […]
  • WooCommerce: Disable Payment Method If Product Category @ Cart
    Today we take a look at the WooCommerce Checkout and specifically at how to disable a payment gateway (e.g. PayPal) if a specific product category is in the Cart. There are two tasks to code in this case: (1) based on all the products in the Cart, calculate the list of product categories in the […]
  • WooCommerce: Add Privacy Policy Checkbox @ Checkout
    Here’s a snippet regarding the checkout page. If you’ve been affected by GDPR, you will know you now need users to give you Privacy Policy consent. Or, you might need customer to acknowledge special shipping requirements for example. So, how do we display an additional tick box on the Checkout page (together with the existing […]
  • WooCommerce: Redirect to Custom Thank you Page
    How can you redirect customers to a beautifully looking, custom, thank you page? Thankfully you can add some PHP code to your functions.php or install a simple plugin and define a redirect to a custom WordPress page (as opposed to the default order-received endpoint). This is a great way for you to add specific up-sells, […]
  • WooCommerce: Disable Payment Gateway by Country
    You might want to disable PayPal for non-local customers or enable a specific gateway for only one country… Either way, this is a very common requirement for all of those who trade internationally. Here’s a simple snippet you can further customize to achieve your objective. Simply pick the payment gateway “slug” you want to disable/enable […]

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent 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. Follow @rmelogli

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

  1. Hi, any solution to remove the icon not to replace it? Thank you,

    1. Yes, you can slightly modify this snippet and try to return nothing

  2. 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 ๐Ÿ™‚

  3. 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 ‘https://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

  4. 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.

      1. 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?

    3. 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!

      1. Nice, thank you ๐Ÿ™‚

  5. 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 ๐Ÿ™‚

  6. 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

  7. thanks a lot, it works prefectly

  8. 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?

  9. 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

  10. 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?

  11. 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 'https://img.jpg'; // change this to your IMAGE URL
      }
       
      add_filter('woocommerce_cod_icon', 'replaceCODicon');
      
      

      Let me know ๐Ÿ™‚

  12. 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 ๐Ÿ™‚

  13. 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? Customization? Leave your comment now!
_____

If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining the Business Bloomer Club to get quick WooCommerce support. Thank you!

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