Title WooCommerce gateway

Viewed 53

I try to modify the title of my payment gateways who are displayed in a tax receipt. But Don't find where to change this.

I have "BACS" that I want to --> virement bancaire I have "Monetico" that I want to --> CB

By'.$order->get_payment_method().'.

I can listen all answers.

Thanks in advance

1 Answers

The hook woocommerce_order_get_payment_method_title is used to change the payment method title that is stored with the order. It will not change the payment method title in the checkout page.

add_filter('woocommerce_order_get_payment_method_title', 'alter_payment_method_title', 10, 2);

function alter_payment_method_title($payment_method_title, $order) {

    if ('Direct Bank Transfer' === $payment_method_title) {
        $payment_method_title = 'virement bancaire';
    }
    if ('Monetico' === $payment_method_title) {
        $payment_method_title = 'CB';
    }
    if ('Cash on delivery' === $payment_method_title) {
        $payment_method_title = 'Cash on arrival';
    }
    return $payment_method_title;
}

Tested ok With WooCommerce 6.4

Add the above code to your active theme functions.php file

Related