diff --git a/includes/reader-activation/class-reader-activation.php b/includes/reader-activation/class-reader-activation.php index 079346a395..7157b2606e 100644 --- a/includes/reader-activation/class-reader-activation.php +++ b/includes/reader-activation/class-reader-activation.php @@ -86,8 +86,6 @@ public static function init() { \add_filter( 'retrieve_password_notification_email', [ __CLASS__, 'password_reset_configuration' ], 10, 4 ); \add_action( 'lostpassword_post', [ __CLASS__, 'set_password_reset_mail_content_type' ] ); \add_filter( 'lostpassword_errors', [ __CLASS__, 'rate_limit_lost_password' ], 10, 2 ); - \add_filter( 'woocommerce_checkout_customer_id', [ __CLASS__, 'associate_existing_woo_users_with_transactions_on_checkout' ] ); - \add_filter( 'woocommerce_checkout_posted_data', [ __CLASS__, 'dont_force_registration_for_existing_woo_users' ], 11 ); } } @@ -1835,40 +1833,5 @@ public static function rate_limit_lost_password( $errors, $user_data ) { } return $errors; } - - /** - * If a reader tries to make a recurring donation with an email address that - * has been previously registered, automatically associate the transaction with the user. - * - * @param int $customer_id Current customer ID. - * @return int Modified $customer_id - */ - public static function associate_existing_woo_users_with_transactions_on_checkout( $customer_id ) { - $billing_email = filter_input( INPUT_POST, 'billing_email', FILTER_SANITIZE_EMAIL ); - if ( $billing_email ) { - $customer = \get_user_by( 'email', $billing_email ); - if ( $customer ) { - $customer_id = $customer->ID; - } - } - return $customer_id; - } - - /** - * Don't force account registration/login on Woo purchases for existing users. - * - * @param array $data Array of Woo checkout data. - * @return array Modified $data. - */ - public static function dont_force_registration_for_existing_woo_users( $data ) { - $email = $data['billing_email']; - $customer = \get_user_by( 'email', $email ); - if ( $customer ) { - $data['createaccount'] = 0; - \add_filter( 'woocommerce_checkout_registration_required', '__return_false', 9999 ); - } - - return $data; - } } Reader_Activation::init();