Support » Plugin: WooCommerce Payments » Display in-line credit card icons

  • Resolved stefanolodola

    (@stefanolodola)


    How to display in-line credit cards icon?

    I was able to do that with the good old Stripe plugin and this snippet:

    function add_credit_card_gateway_icons( $icon_string, $gateway_id ) {
    
    if ( 'stripe' === $gateway_id ) {
    
    $icon_string  = '<img src="' . WC_STRIPE_PLUGIN_URL . '/assets/images/visa.svg" alt="Visa" />';
    $icon_string .= '<img src="' . WC_STRIPE_PLUGIN_URL . '/assets/images/mastercard.svg" alt="mastercard" />';
    $icon_string .= '<img src="' . WC_STRIPE_PLUGIN_URL . '/assets/images/amex.svg" alt="amex" />';
    $icon_string .= '<img src="' . WC_STRIPE_PLUGIN_URL . '/assets/images/diners.svg" alt="diners" />';
    $icon_string .= '<img src="' . WC_STRIPE_PLUGIN_URL . '/assets/images/jcb.svg" alt="jcb" />';
    
    }
    	
    
    	
    	
    return $icon_string;
    }
    
    add_filter( 'woocommerce_gateway_icon', 'add_credit_card_gateway_icons', 10, 2 );

    Is there anything like this for Woocommerce Payments?

    I tried this (yes, the gateway ID is long), but nothing happened:

    if ( 'pre_install_woocommerce_payments_promotion' === $gateway_id ) {
    
    $icon_string  = '<img src="' . WC_STRIPE_PLUGIN_URL . '/assets/images/visa.svg" alt="Visa" />';
    $icon_string .= '<img src="' . WC_STRIPE_PLUGIN_URL . '/assets/images/mastercard.svg" alt="mastercard" />';
    $icon_string .= '<img src="' . WC_STRIPE_PLUGIN_URL . '/assets/images/amex.svg" alt="amex" />';
    $icon_string .= '<img src="' . WC_STRIPE_PLUGIN_URL . '/assets/images/discover.svg" alt="Discover" />';
    $icon_string .= '<img src="' . WC_STRIPE_PLUGIN_URL . '/assets/images/diners.svg" alt="diners" />';
    $icon_string .= '<img src="' . WC_STRIPE_PLUGIN_URL . '/assets/images/jcb.svg" alt="jcb" />';
    
    }
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.