No, merging will simply copy your WC’s billing phone field to plugin’s phone field.
It is not going to affect your site in anyway even if you abort or re run the code.
Completely safe.
(Goes in functions.php)
1) Change +91 below to your country code if not India
2) Visit https://www.yourwebsite.com/wp-admin/admin.php?page=xoo-ml, the code will run & it may take few seconds to load page.
Once the page is loaded, you can remove the code.
add_action( 'init', function(){
if( !is_admin() || wp_doing_ajax() || !isset( $_GET['page'] ) || $_GET['page'] !== 'xoo-ml' ) return; // run only on otp settings page
$args = array(
'role' => 'customer',
);
$users = get_users( $args );
$phone_code = '+91';
//loop users
foreach ( $users as $user ) {
$billing_phone = get_user_meta( $user->ID, 'billing_phone', true ); //Get billing phone
if( !$billing_phone ) continue; // switch to next user if billing phone is empty
update_user_meta( $user->ID, 'xoo_ml_phone_code', $phone_code ); //Update phone code required for login
update_user_meta( $user->ID, 'xoo_ml_phone_no', $billing_phone ); //Update phone number required for login
update_user_meta( $user->ID, 'xoo_ml_phone_display', $phone_code.$billing_phone ); // Just for display
}
} );
-
This reply was modified 3 years, 3 months ago by xootix.
-
This reply was modified 3 years, 3 months ago by xootix. Reason: Code updated