How to Remove Obscure Payment Logos (Icons) from WooCommerce Stripe Gateway

Robin ScottWooCommerce Tutorials2 Comments

If you use the WooCommerce payment Gateway Stripe – and why wouldn’t you, it rocks rocks rocks! – and your currency is set to USD, you’ll notice that, as well as the common old Visa, Mastercard and American Express logo icons, you also see the not-quite-so-common Diners, JCB and Discover cards.

On a recent project, the size of the checkout was really important to our client, who wanted to lost JCB and Diners cards in order to keep the payment logos “on one line” when it came to narrower displays, like a mobile held vertically, for example.

So we added some code to make this happen, using the WooCommerce filter woocommerce_gateway_icon.

When I wrote this little snippet, I found that the docs and tutorials out there were not so helpful and not so great. So I thought I’d give you all something back (Open Source. Woop.) with a snippet which describes how to get a superfluous payment service icon gone for good from your Stripe checkout!

How to Remove Obscure Payment Logos (Icons) from WooCommerce Stripe Gateway

Add the following snippet to your themes functions.php or a helper plugin:

Now, please note, that you should replace the entire URL of the icon image in question, which you can find by right clicking like this:

Also it should be noted that the svg ending and the “style…” part will not be there for WooCommerce versions before 2.6. If you have WooCommerce version earlier than 2.6, then please update. Just update. But also note, the above snippet will. Not. Work!

Leave a comment below if this helped make your day, just a little bit, easier.

2 Comments on “How to Remove Obscure Payment Logos (Icons) from WooCommerce Stripe Gateway”

    1. Thanks for the comment – actually I renamed my Github last week, and this (one) Gist didn’t get picked when I swapped the links here! Should now be fixed. I’d not have seen that without your comment though so thanks +1

Leave a Reply

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