Code-Snippets-Functions/Execute a function on a child site/WooCommerce/sync-billing-name-to-user-profile.txt

17 lines
600 B
Text

add_filter( 'pre_user_first_name', 'wc_sync_user_edit_profile_edit_billing_first_name' );
function wc_sync_user_edit_profile_edit_billing_first_name( $first_name ) {
if ( isset( $_POST['billing_first_name'] ) ) {
$first_name = $_POST['billing_first_name'];
}
return $first_name;
}
add_filter( 'pre_user_last_name', 'wc_sync_user_edit_profile_edit_billing_last_name' );
function wc_sync_user_edit_profile_edit_billing_last_name( $last_name ) {
if ( isset( $_POST['billing_last_name'] ) ) {
$last_name = $_POST['billing_last_name'];
}
return $last_name;
}