Automattic\WooCommerce\Internal\CustomerEmailVerification

VerificationController::should_show_promptpublicWC 11.0.0

Return whether the verification prompt should be shown for the current user.

True for a logged-in, unverified customer, except one still using a temporary password (those confirm via their set-password link, so the temporary-password notice already covers it). This must not depend on whether matching guest orders exist, because that would disclose order existence before the customer proves they control the email address.

Method of the class: VerificationController{}

No Hooks.

Returns

true|false.

Usage

$VerificationController = new VerificationController();
$VerificationController->should_show_prompt(): bool;

Changelog

Since 11.0.0 Introduced.

VerificationController::should_show_prompt() code WC 11.0.0

public function should_show_prompt(): bool {
	$user_id = get_current_user_id();

	if ( ! $user_id ) {
		return false;
	}

	if ( $this->service->is_verified( $user_id ) ) {
		return false;
	}

	// A temporary-password account already has a set-password link (which also verifies on use),
	// surfaced by the temporary-password notice — don't show a second prompt alongside it.
	if ( get_user_option( 'default_password_nag', $user_id ) ) {
		return false;
	}

	return true;
}