Forked from clifgriffin/add_shipping_phone_to_order_emails.php
Created
June 15, 2020 17:03
-
-
Save Asikur22/3fafe6842d02a5892c92cd76a78ec1ba to your computer and use it in GitHub Desktop.
Add CheckoutWC shipping phone number to WooCommerce order email.
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
<?php | |
// Do NOT include the opening php tag. | |
// Place in your theme's functions.php file | |
/** | |
* Add a custom field (in an order) to the emails | |
*/ | |
add_filter( 'woocommerce_email_order_meta_fields', 'custom_woocommerce_email_order_meta_fields', 10, 3 ); | |
function custom_woocommerce_email_order_meta_fields( $fields, $sent_to_admin, $order ) { | |
$fields['meta_key'] = array( | |
'label' => __( 'Shipping Phone' ), | |
'value' => get_post_meta( $order->id, '_shipping_phone', true ), | |
); | |
return $fields; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment