Skip to content

Instantly share code, notes, and snippets.

@thebigtine
Last active August 9, 2016 11:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save thebigtine/8c80f437152776ff4019491cdee92dbc to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Autofill users info at checkout
*/
function autofill_users_info_at_checkout_update_mata( $user_id ) {
add_user_meta($user_id, 'billing_phone', '0123456789');
}
add_action( 'user_register', 'autofill_users_info_at_checkout_update_mata', 10, 1 );
<?php
/*
Plugin Name: Autofill users info at checkout
*/
function autofill_users_info_at_checkout_update_mata( $user_id ) {
// First attempt
update_user_meta($user_id, 'billing_phone', $_POST['user_login']);
// Second attempt
update_user_meta($user_id, 'billing_phone', get_user_meta( $user_id, 'user_login', true));
}
add_action( 'user_register', 'autofill_users_info_at_checkout_update_mata', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment