I want to make some changes if the chosen payment method is COD. On existing WC_Order i have used
($order->payment_method_title == \'Cash On Delivery\' ? ...
2019 now, if you want the title of the payment method you can do:
$order = new WC_Order( $order_id ); $payment_title = $order->get_payment_method_title();
This returns the string set in the Woocommerce > Payment methods, ex: Paypal.
Paypal
Cheers.