I've got that code that displays a coupon message in the email orders if the customer has not used any in this order.
I would like to display that coupon message only on completed order instead on all mails.
add_action( 'woocommerce_email_before_order_table', 'processing_order_mail_message', 20 );
function processing_order_mail_message( $order ) {
if ( empty( $order->get_used_coupons() ) && ( $order->post_status == 'wc-on-hold' || $order->post_status == 'wc-processing' ) )
echo '<h2 id="h2thanks">Get 20% off</h2><p id="pthanks">Thank you for making this purchase! Come back and use the code "<strong>Back4More</strong>" to receive a 20% discount on your next purchase! Click here to continue shopping.</p>';
}
How can I achieve that?
Thanks
It is possible easily to display a custom message on emails with an
if
statement and 2 conditions, for "complete" order status only.This code is tested and works perfect
Reference: