Last active
August 22, 2017 14:28
-
-
Save justinstern/9145189 to your computer and use it in GitHub Desktop.
Adding some payment instructions to WooCommerce order processing email
This file contains hidden or 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
<?php | |
// Add the following to your theme's functions.php: | |
add_action( 'woocommerce_order_status_pending_to_processing_notification', 'watch_for_processing_email', 5 ); | |
add_action( 'woocommerce_order_status_pending_to_on-hold_notification', 'watch_for_processing_email', 5 ); | |
function watch_for_processing_email() { | |
// only add the instructions for processing type emails | |
add_action( 'woocommerce_email_before_order_table', 'add_order_email_instructions', 10, 2 ); | |
} | |
function add_order_email_instructions( $order, $sent_to_admin ) { | |
if ( ! $sent_to_admin ) { | |
if ( 'bacs' == $order->payment_method ) { | |
echo '<p><strong>Instructions:</strong> Your order will not be processed until the money is transfered</p>'; | |
} elseif ( 'authorize_net' == $order->payment_method ) { | |
echo '<p><strong>Instructions:</strong> Please look for Acme, Inc on your next credit card statement</p>'; | |
} | |
} | |
} |
this gets added to your theme's functions.php
This is not working on woocommerce 2.3.7, is there a fix or a work around?
Thank you!
Could you tell me how to only add the text to the order-processing-email if chosen payment method is Paypal?
Getting the below error
Warning: Missing argument 2 for add_order_email_instructions() in /home/completecleanse/public_html/wp-content/themes/organicfood/functions.php on line 1057
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Many thanks.
Where should I put this please?