Change any payment gateway icon

Change any payment gateway icon with this piece of code that goes into your functions.php. Simply change the icons / returned HTML to suit your site.

add_filter( 'woocommerce_gateway_icon', function ( $icon, $id ) {
  if ( $id === 'st_gateway' ) {
    return '<img src="/wp-content/uploads/2019/09/card-visa.svg" alt="visa" class="sv-wc-payment-gateway-icon wc-braintree-credit-card-payment-gateway-icon" style="width: 40px;height: 25px" width="40" height="25"><img src="/wp-content/uploads/2019/09/card-mastercard.svg" alt="mastercard" class="sv-wc-payment-gateway-icon wc-braintree-credit-card-payment-gateway-icon" style="width: 40px;height: 25px" width="40" height="25"><img src="/wp-content/uploads/2019/09/card-maestro.svg" alt="maestro" class="sv-wc-payment-gateway-icon wc-braintree-credit-card-payment-gateway-icon" style="width: 40px;height: 25px" width="40" height="25">';
  } else {
    return $icon;
  }
}, 10, 2 );

 


Leave a Reply

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