WordPress Development Asked by Stanley Tan on December 6, 2021
How do you add a user custom field into Woocommerce emails?
This is my code so far in functions.php
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' => __( 'Store number' ),
'value' => get_user_meta( $user_id, 'wpcf-store-number', true ),
);
return $fields;
}
The user custom field is wpcf-store-number which is already in the database. All I need to do now is to show it in the order confirmation email / New order email.
this link will help you. It is from the Woocommerce repository only
https://docs.woocommerce.com/document/add-a-custom-field-in-an-order-to-the-emails/
Answered by Sahil Doshi on December 6, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP