您可以简单地钩住函数以同步电话号码字段,如下所示;
<?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 );
}
?>
这样,每当管理员要从仪表板添加或更新用户/客户时,您的电话号码字段的值将在其他WooCommerce计费电话号码字段中更新。