Created
March 3, 2015 08:33
-
-
Save cezarpopa/dc1c127a77b78e683ab3 to your computer and use it in GitHub Desktop.
Add the title of the payment and custom field from payment in woocoomerce emails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This function will add the Payment title method to the emails | |
*/ | |
add_action( 'woocommerce_email_before_order_table', 'add_payment_method_to_new_order', 10, 2 ); | |
function add_payment_method_to_new_order( $order) { | |
$method = get_post_meta( $order->id, '_payment_method', true ); | |
$method_1 = "directdebit"; | |
$method_2 = "cecdebit"; | |
if ( $method == $method_1 ) { | |
$cec_number = get_post_meta($order->id, 'dg_iban_number', true); | |
echo '<p><strong>Payment Method:</strong> ' . $order->payment_method_title . '| Termen: ' . $cec_number . '</p>'; | |
} elseif ( $method == $method_2 ) { | |
$dg_iban_number = get_post_meta($order->id, 'dg_iban_number', true); | |
echo '<p><strong>Payment Method:</strong> ' . $order->payment_method_title . '| Termen: ' . $dg_iban_number . '</p>'; | |
} else { | |
echo '<p><strong>Payment Method:</strong> ' . $order->payment_method_title . '</p>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment