You can simply hook function to sync phone number field as following;
<?php
// HOOK ON REGISTERING NEW USER/CUSTOMER
add_action('user_register', 'mm_sync_phone_number' , 20, 1);
// HOOK ON PERSONAL OPTIONS UPDATE
add_action('personal_options_update', 'mm_sync_phone_number' , 20, 1);
// HOOK ON USER PROFILE UPDATE
add_action('edit_user_profile_update','mm_sync_phone_number' , 20, 1);
function mm_sync_phone_number( $user_id ) {
// GET PHONE NUMBER FROM OTHER FIELD
$phone_number = get_user_meta( $customer_id, 'meta_key_of_other_phone_field', true );
// UPDATE PHONE NUMBER IN BILLING PHONE NUMBER FIELD
update_user_meta( $user_id, 'billing_phone', $phone_number );
}
?>
This way every time, whenever admin is going to add or update user/customer from the dashboard, the value of your phone number field will be updated in the other WooCommerce billing phone number field.
Related Posts:
- Adding fields to the “Add New User” screen in the dashboard
- Authors details such as social media links, emails etc → Is this Meta or something else?
- Search user metadata with checkboxes via ajax (almost working)
- Calling a function from anywhere, used in different places
- create shortcode to list users with specific meta key value
- Last Login in number of days format
- Why is functions.php file in child not initializing and over-writing parent?
- Update user meta of author when post content is viewed
- is_author(get_current_user_id()) returns false when author id and user id match
- How to get data from an array using get_user_meta()
- Adding an option to a shortcode
- Need To Change WordPress Meta Tags… Includes wordpress shortcodes
- wp_usermeta – Read from database, but save function broken
- Function that prevents users from uploading photos more photos
- Function to pull data from user meta not working
- User meta and public function security
- Get users with different roles and call function on each of them (user_meta)
- Message notification for user
- delete_user_meta for user in spesific group
- How can I include user meta information in the resulting array of a WP_User_Query?
- update_usermeta don’t work
- How to Update User Meta Field other than from profile?
- Dynamically Generating User Meta Field
- User’s Comments Number: Storing it in a meta field for different uses
- Customize WordPress Media Manager – Media Window
- How to override functions.php in child theme?
- Remove Page Title from Static Frontpage
- Default or Preset Content for Custom Post Types
- Problem using is_single() to enqueue script from functions.php
- If function exists, and array is met, echo function?
- Breadcrumb how i can display page title with parent > child title with permalink ? any Idea
- change a post status when users update posts?
- How often is functions.php loaded?
- Display height and width properties with the_post_thumbnail() or related function
- Cleaner way to access custom fields in code?
- change default option in wp_dropdown_categories
- Display a text message if the shortcode is found?
- How to store / access files in child theme folder
- How to use IF Statement in WordPress?
- Woocommerce Storefront WordPress Ignore Media Gallery Images and use External 3rd Party Host
- Use of undefined constant bloginfo
- How would go about if I just want a temporary function?
- Ninja form Redirect depending on text field content [closed]
- Display Password Protected external RSS in wordpress template
- Custom HTML in specific category single page and its descendant categories
- Modify a function without editing template
- Problem only while using require_once() within functions.php
- Override widget in function WordPress
- How to change or add user role after getting post request data about pay? [closed]
- How to force field validation first, then its values saved durning edit profile?
- Filter out other users comments. Visualize only own comments and editor role users’ comments
- How to properly remove style for non logged in and front page only
- WordPress converts media extention URL automatically to video player
- Automatically include all php files in a child theme directory
- How do you Permanently Delete Sidebars
- Add a unique class to HTML tag/element
- Allow Contributor to edit their own posts after Adm aproval
- help I changed one currency in woocommerce and everything is ruined [closed]
- How to run a function in every page, every device
- Which function required?
- How to ignore posts in pre_get_posts?
- How to retrieve the values of a sub-field in the first and last row of an (ACF) repeater inside function?
- AJAX error handling for submit function in functions file
- New functions in separate directory — better, portable way
- get_pages() Returns Only One Item
- WordPress Migration error phpupdate_option is not a function
- Custom Query Not Paginating
- Use a shortcode to display custom meta box contents
- Solved: redirect to another page using functions.php
- Getting the teaser text without overriding global variables
- Solution dealing with Child Theme / Parent theme functions
- Ajax resetting my global variable
- Problem enqueuing scripts on not single posts
- referencing the current user in a page i created in wordpress
- is_main_query() always returning false
- Undefined variable issue for wp_get_attachment_image_url
- Counting posts and trigger it [closed]
- ACF Flexible in TCPDF
- modifying every other element’s class inside while loop
- Adding Custom Body Class for Page: Shop
- Replace theme function
- “Conditional query tags do not work before the query is run. Before > then, they always return false. “
- Change ‘Categories’ to ‘Topics’
- How to add styles in existing function?
- admin-ajax.php 403 forbidden only when calling from external file
- getExcerpt: Make ellipsis appear only if character limit is reached
- Dynamic Title for custom post types
- How do I change the URL returned by next_posts_link()?
- WordPress SEO By Yoast Plugin is interfering with a custom function code – how to troubleshoot and fix it?
- shortcode inside post called by ID does not render as expected
- Adding and updating repeating custom field meta data
- How to get postId from the argument $block when register_block_type()?
- WordPress is adding pagination for all pages not only for blog page, How to remove pagination for all pages except blog/posts page?
- Is storing in a variable the result of a fonction a most powerful way to code an if structures in WordPress?
- Get all users from role and add to dropdown (select) – wordpress, javascript
- woocommerce_sort_product_tabs() expects an array
- Add functionality to block comment authors in the Comment edit pag
- WordPress enque the same script causes the setInterval not to work
- Customizer cuistom CSS Priority ordre Issue
- WPDB query suddenly not working