Created
November 6, 2024 06:04
-
-
Save pramodjodhani/1371e055356b4170eb50112532f3f988 to your computer and use it in GitHub Desktop.
Flux Woo Subscription - disable create account/password for known users.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Flux checkout - remove password field. | |
| */ | |
| function iconic_flux_remove_pass_field( $fields ) { | |
| unset( $fields['account']['account_password'] ); | |
| return $fields; | |
| } | |
| add_filter( 'woocommerce_checkout_fields', 'iconic_flux_remove_pass_field', 9999 ); | |
| /** | |
| * Flux checkout - Disable customer login requirement. | |
| */ | |
| function flux_remove_customer_login_requirement() { | |
| return false; | |
| } | |
| add_filter( 'woocommerce_checkout_registration_required', 'flux_remove_customer_login_requirement', 100000 ); | |
| /** | |
| * Remove `createaccount` data from checkout data so it doesnt trigger the `Login to your account` error. | |
| */ | |
| function flux_remove_createaccount_data_for_known_users( $posted_data ) { | |
| if ( email_exists( $posted_data['billing_email'] ) ) { | |
| unset( $posted_data['createaccount'] ); | |
| } | |
| return $posted_data; | |
| } | |
| add_filter( 'woocommerce_checkout_posted_data', 'flux_remove_createaccount_data_for_known_users' ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment