Change Specific Payment Gateway Title and Description

Change Title
add_filter( 'woocommerce_gateway_title', 'rudr_change_payment_gateway_title', 25, 2 );
function rudr_change_payment_gateway_title( $title, $gateway_id ){
if( 'cod' === $gateway_id ) {
$title = 'By Cash or Credit Card on delivery';
}
return $title;
}
- What is
$gateway_id
and where to get it? I think the easiest way is to use this code snippet which adds a payment gateway ID column in WooCommerce settings. - Where to insert the code? Well, you can use your current theme
functions.php
, but please keep in mind, that if your theme received updates, it is better to create a child theme or a custom plugin for this purpose.
Need custom coding help with WooCommerce payment gateways? – Contact me.
Change Description
The similar way but with filter hook woocommerce_gateway_description
you can do it for a payment method description.
add_filter( 'woocommerce_gateway_description', 'rudr_change_payment_gateway_description', 25, 2 );
function rudr_change_payment_gateway_description( $description, $gateway_id ) {
if( 'cod' === $gateway_id ) {
// you can use HTML tags here
$description = 'Pay with cash upon delivery. Easy-breezy ;)';
}
return $description;
}

Misha Rudrastyh
Hey guys and welcome to my website. For more than 10 years I've been doing my best to share with you some superb WordPress guides and tips for free.
Need some developer help? Contact me
Works great!