Created
April 10, 2018 23:11
-
-
Save jondcampbell/9be9571dc234e6aa6a6660afecb4fa1f to your computer and use it in GitHub Desktop.
WooCommerce order email billing country
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
/* | |
* Let's add some more information to the customer details block in admin emails | |
* This particular example adds the billing country | |
*/ | |
function mysite_filter_woocommerce_email_customer_details_fields( $fields, $sent_to_admin, $order ) { | |
if ( $order->billing_country ) { | |
$fields['billing_country'] = array( | |
'label' => __( 'Country', 'woocommerce' ), | |
'value' => WC()->countries->countries[ $order->billing_country ], | |
); | |
} | |
return $fields; | |
}; | |
// add the filter | |
add_filter( 'woocommerce_email_customer_details_fields', 'mysite_filter_woocommerce_email_customer_details_fields', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment