Change Specific Payment Gateway Title and Description

Change WooCommerce payment gateway title and description
In this example we change “Cash on delivery” payment gateway title and description. The code from this post applies to both “Checkout” and “Pay for order” pages.

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

Misha Rudrastyh

I develop websites since 2008, so it is total of 14 years of experience, oh my gosh. Most of all I love love love to create websites with WordPress and Gutenberg, some ideas and thoughts I share throughout my blog.

Need some developer help? Contact me

Follow me on Twitter