Thursday, March 20, 2014

Adding Payment Method To Order Email In WooCommerce

This is the method I would use since it doesn’t require editing any of WooCommerce e-mail templates, all you have to do is add a few lines of code to your functions.php file.

add_action( 'woocommerce_email_after_order_table', 'iwc_display_payment_method_email_order' );
function iwc_display_payment_method_email_order( $order, $is_administrator_email ) {
    if( $is_administrator_email ) {
        echo '<h3>Payment Method:</h3><p>' . $order->payment_method_title . '</p>';
    }
}

Try removing the if ( $is_admin_email ) { check, and the corresponding }. That if statement was limiting the output to the admin emails only, removing it should add the content to all emails.

No comments:

Post a Comment