Skip to content

Instantly share code, notes, and snippets.

@justinstern
Last active August 22, 2017 14:28
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinstern/9145189 to your computer and use it in GitHub Desktop.
Save justinstern/9145189 to your computer and use it in GitHub Desktop.
Adding some payment instructions to WooCommerce order processing email
<?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>';
}
}
}
@jimslip
Copy link

jimslip commented Apr 13, 2014

Many thanks.
Where should I put this please?

@justinstern
Copy link
Author

this gets added to your theme's functions.php

@mexin
Copy link

mexin commented Apr 8, 2015

This is not working on woocommerce 2.3.7, is there a fix or a work around?

Thank you!

Copy link

ghost commented Oct 31, 2015

Could you tell me how to only add the text to the order-processing-email if chosen payment method is Paypal?

@austinwebdeveloper
Copy link

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