May be the best way is to emulate it comparing for the order the billing and the shipping addresses. In most of all available related email notification hooks, the $order
object is included as a parameter.
Here is an example with this function hooked in woocommerce_email_order_details
action hook, that will display something different depending on that:
add_action( 'woocommerce_email_order_details', 'custom_content_email_order_details', 10, 4 );
function custom_content_email_order_details( $order, $sent_to_admin, $plain_text, $email ){
// Only for "New Order" and admin email notification
if ( 'new_order' != $email->id && ! $sent_to_admin ) return;
// Displaying something related
if( $order->get_billing_address_1() != $order->get_shipping_address_1() ) {
echo '<p style="color:red;">Different billing and shipping addresses<p>';
} else {
echo '<p style="color:green;">Same billing and shipping addresses<p>';
}
}
Code goes in function.php file of your active child theme (or theme) or also in any plugin file.
This code is tested in WooCommerce 3.1+ and works
You can also use (with different priorities) any of the following hooks in this code:
- woocommerce_email_before_order_table
- woocommerce_email_after_order_table
- woocommerce_email_order_meta
- woocommerce_email_customer_details