Menu Close

WooCommerce: Add Payment Method to Order Emails

default

If you wish to print the payment gateway name on order emails (in its own paragraph below the order items table), here’s a handy snippet for you.

All you need to use is the “woocommerce_email_after_order_table” hook to pick the correct position, and then the “get_payment_method_title” WooCommerce function to return the payment gateway name. Enjoy!

Add payment type to order emails in WooCommerce
Add payment type to order emails in WooCommerce

PHP Snippet: Show Payment Gateway Name @ WooCommerce Order Emails

/**
 * @snippet       Echo Payment Method Name @ Order Emails
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @testedwith    WooCommerce 3.9
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */

add_action( 'woocommerce_email_after_order_table', 'bbloomer_display_payment_type_name_emails', 15 );
 
function bbloomer_display_payment_type_name_emails( $order ) {
   echo '<h2>Payment Type:</h2><p> ' . $order->get_payment_method_title() . '</p>';
}
View Source
Posted in WooCommerce Tips