Created
March 19, 2019 19:56
-
-
Save clifgriffin/958a47c31ba933c7649a4aaf4fa359ac to your computer and use it in GitHub Desktop.
Add CheckoutWC shipping phone number to WooCommerce order email.
This file contains hidden or 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