How to change the PayPal logo in my woocommerce checkout

Hi,

I’m using Woocommerce for my online shop and for the payments, I’m using Woocommerce Paypal Checkout (I prefer it to the standard Paypal method).

I would like to change the Paypal logo that I see in my checkout page, since the logo is not teamed with the other credit card logos (Masterd card, Visa, etc).

Of course, there is a message telling the clients they can use their credit card without having a PayPal account, but I think the logos of the other credit cards is really reassuring for the customers.

I found this code :

add_filter ( ‘woocommerce_gateway_icon’, ‘htdat_change_gateway_icon’, 10, 2 );
function htdat_change_gateway_icon( $icon, $gateway_id ) {
if ( ‘ppec_paypal’ == $gateway_id ) {
//Change the URL of your own icon here
$icon = ‘my-own-icon.png’;
}

return $icon;

}

Among all the codes in web for the same purpose, this one seems to work, because it replaces the logo with : ‘my-own-icon.png’.

But because I am not familiar with it, I’m not sure how to put the url of the new logo I would like to show instead.

Any suggestions into how to modify this code above that seems to work.

Thank you.

My url is : http://mazonegourmet.com/

Hello @ProductionMD1986

Thanks for writing to us.

To replace the PayPal logo on the checkout page, this feature is not offered in the theme and the builders.
This code is not correct code to change the PayPal Logo. Please check out this article to change the Paypal Logo on the checkout page.

Thanks

Hi,

I tried the one from the post you suggested and I don’t have any results.

But the code I was talking about above really works.

I got it from this post by the author

add_filter ( ‘woocommerce_gateway_icon’, ‘htdat_change_gateway_icon’, 10, 2 );
function htdat_change_gateway_icon( $icon, $gateway_id ) {
if ( ‘ppec_paypal’ == $gateway_id ) {
//Change the URL of your own icon here
$icon = ‘my-own-icon.png’;
}

return $icon;

}

Look at those screenshots

But I dont know how to replace the line ‘my-own-icon.png’ by the url of the logo I want there instead.

Any suggestions?

Hello @ProductionMD1986,

If this code is working at your place now, you just need to upload an image for the Paypal logo through WordPress media.
Now copy the image source URL from the media.
After that, you need to change your code like $icon = ‘my-own-icon.png’; to $icon = 'http://example.com/wp-content/uploads/2020/08/Lighthouse.jpg';
Please note that I have given an example to add the image source URL. You can change image source URL as per your image source URL

In case if you don’t know how to upload an image through WordPress media please have look at this article

Thanks

I thought about that too… and this is what it gives :

The image is not displayed, only the url line of the image.

Hello @ProductionMD1986

Please share your details in a secure note. Please provide the following details.

  • WordPress Login URL
  • Admin level username and password

You can find the Secure Note button at the bottom of your post

We’ll check it, but if it happens to be an issue with the payment gateway then we can’t further help, you must contact the developer to be able to fix it. This is not a theme related issue.

Thanks

Sure, here it is:

Just to be clear, If I don’t do anything, this is how it looks like :

And I want to replace it by this :

Hi @ProductionMD1986,

The only missing piece in your code is the <img src""> because currently in your code the image src you provided is just a plain text unless you will put it inside an <img src"">.

add_filter ( 'woocommerce_gateway_icon', 'htdat_change_gateway_icon', 10, 2 );
function htdat_change_gateway_icon( $icon, $gateway_id ) {
  if ( 'ppec_paypal' == $gateway_id ) {
	//Change the URL of your own icon here
	$icon = 'https://mazonegourmet.com/wp-content/uploads/2020/08/AM_mc_vs_dc_ae.jpg';
  }
  return $icon;
}

The correct way of implementing your code:

add_filter ( 'woocommerce_gateway_icon', 'htdat_change_gateway_icon', 10, 2 );
    function htdat_change_gateway_icon( $icon, $gateway_id ) {
      if ( 'ppec_paypal' == $gateway_id ) {
    	//Change the URL of your own icon here
    	$icon = '<img src="https://mazonegourmet.com/wp-content/uploads/2020/08/AM_mc_vs_dc_ae.jpg">';
      }
      return $icon;
    }

Please note that custom development is outside the scope of our support. Issues that might arise from the use of custom code and further enhancements should be directed to a third-party developer.

Hope that helps.

Thank you.

Thank you very much!
It works!

Hi @ProductionMD1986,

It’s our pleasure to help you. If you have any other concerns please don’t hesitate to create a new ticket.

Thank you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.