One of my premium course students had an apparently simple requirement. Her client didn’t want to show the “What is PayPal?” text (and link) on the checkout page. In fact, why sending users away from the checkout? And who doesn’t know what PayPal is nowadays? Well, let’s see how this is done via a simple “filter” – but this time I’d like to show you a step-by-step tutorial! Let me know what you think about this in the comments 🙂

1. WooCommerce Plugin File Search
First, we try to find where this “What is PayPal” is generated from, usually a PHP function. In fact, this is what shows in the woocommerce\includes\gateways\paypal\class-wc-gateway-paypal.php file:
/**
* Get gateway icon.
* @return string
*/
public function get_icon() {
$icon_html = '';
$icon = (array) $this->get_icon_image( WC()->countries->get_base_country() );
foreach ( $icon as $i ) {
$icon_html .= '<img src="' . esc_attr( $i ) . '" alt="' . esc_attr__( 'PayPal Acceptance Mark', 'woocommerce' ) . '" />';
}
$icon_html .= sprintf( '<a href="%1$s" class="about_paypal" onclick="javascript:window.open(\'%1$s\',\'WIPaypal\',\'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=1060, height=700\'); return false;" title="' . esc_attr__( 'What is PayPal?', 'woocommerce' ) . '">' . esc_attr__( 'What is PayPal?', 'woocommerce' ) . '</a>', esc_url( $this->get_icon_url( WC()->countries->get_base_country() ) ) );
return apply_filters( 'woocommerce_gateway_icon', $icon_html, $this->id );
}
2. Boom! The function is “filterable”
WooCommerce gives us this, so that we can “filter” or “edit” the behavior of such function without having to override WooCommerce core files:
return apply_filters( 'woocommerce_gateway_icon', $icon_html, $this->id );
3. Let’s find the HTML code that we need to filter
Now that we know the function is editable via a hook (filter), we find out that the “What is PayPal” link is added by the variable $icon_html.
$icon_html .= sprintf( '<a href="%1$s" class="about_paypal" onclick="javascript:window.open(\'%1$s\',\'WIPaypal\',\'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=1060, height=700\'); return false;" title="' . esc_attr__( 'What is PayPal?', 'woocommerce' ) . '">' . esc_attr__( 'What is PayPal?', 'woocommerce' ) . '</a>', esc_url( $this->get_icon_url( WC()->countries->get_base_country() ) ) );
Please note the “.=”: this means $icon_html is being concatenated to the previous $icon_html, which contains the PayPal image:
$icon_html .= '<img src="' . esc_attr( $i ) . '" alt="' . esc_attr__( 'PayPal Acceptance Mark', 'woocommerce' ) . '" />';
4. Let’s code the PHP snippet: How to Remove “What is PayPal?” @ Checkout
Now that we have all the information, let’s start coding. Take a look at the comments in the PHP snippet to see if you can follow me.
/**
* @snippet WooCommerce Remove "What is PayPal?" @ Checkout
* @how-to Get CustomizeWoo.com FREE
* @sourcecode https://businessbloomer.com/?p=21186
* @author Rodolfo Melogli
* @compatible WooCommerce 3.5.4
* @donate $9 https://businessbloomer.com/bloomer-armada/
*/
add_filter( 'woocommerce_gateway_icon', 'bbloomer_remove_what_is_paypal', 10, 2 );
function bbloomer_remove_what_is_paypal( $icon_html, $gateway_id ) {
if( 'paypal' == $gateway_id ) {
$icon_html = '<img src="/wp-content/plugins/woocommerce/includes/gateways/paypal/assets/images/paypal.png" alt="PayPal Acceptance Mark">';
}
return $icon_html;
}
5. Summary
To summarize:
1) I’m calling the filter with: add_filter( ‘woocommerce_gateway_icon’, …
2) I’m creating my custom override function ‘bbloomer_remove_what_is_paypal’
3) I’m passing to the function two variables: the HTML ($icon_html) and the gateway name ($gateway_id), as we need to make sure we override those through the filter
4) I make sure this is the PayPal gateway with the if > then
5) I edit the $icon_html variable, by just saying “trash the previous, use mine instead”
6) I return $icon_html to the system
Let me know in the comments if this “extended” tutorial helps 🙂