Skip to content

How to fill out Woocommerce-Shipping and Billing Address from OpenID-UserInfo-Claims? #321

Answered by svenniuwe
svenniuwe asked this question in Q&A
Discussion options

You must be logged in to vote

Here we go, this has to be pasted into the Woocommerce-Child-Template "functions.php" and then these fields are created and updated when using OIDC-Login:

`add_action('openid-connect-generic-update-user-using-current-claim', function( $user, $user_claim) {

$userid = $user->ID;

update_user_meta($userid, 'billing_first_name', (string) isset( $user_claim['billing_first_name'] ) ? $user_claim['billing_first_name'] : '');
update_user_meta($userid, 'billing_last_name', (string) isset( $user_claim['billing_last_name'] ) ? $user_claim['billing_last_name'] : '');
update_user_meta($userid, 'billing_email', (string) isset( $user_claim['billing_email'] ) ? $user_claim['billing_email'] : '' );
update…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by svenniuwe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant