Skip to content

Instantly share code, notes, and snippets.

@jondcampbell
Created April 10, 2018 23:11
Show Gist options
  • Save jondcampbell/9be9571dc234e6aa6a6660afecb4fa1f to your computer and use it in GitHub Desktop.
Save jondcampbell/9be9571dc234e6aa6a6660afecb4fa1f to your computer and use it in GitHub Desktop.
WooCommerce order email billing country
/*
* 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