-
Hello, Now I run Woocommerce on this Wordpress-Site and need to bring over the complete billing and shipping address via OpenID-UserInfo-Claim. I imagine if someone could provide some codesnippet for one field like e.g. "city", then I should manage to add the other fields myself :) Any hint/help is highly appreciated. Thank you for all! UPDATED: After a little research this modification maybe (?) straightforward.
As these fields should already exists from Woocommerce the correct Wordpress-Call should be:
Even better (to be save when woocommerce is not installed): `if ( metadata_exists( 'user', $user->ID, 'billing_postcode' ) ) {
} UPDATE 2 - now I've found the (probably?) correct field names: 'billing_first_name', 'shipping_first_name', UPDATE 3 if ( class_exists( 'woocommerce' ) ) { Probably then better using WooCommerce-Classes: // Get an instance of the WC_Customer Object from the user ID $customer->set_billing_country('US'); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
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) {
}, 10, 2); add_action('openid-connect-generic-user-create', function( $user, $user_claim) {
}, 10, 2);` |
Beta Was this translation helpful? Give feedback.
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) {