Automattic\WooCommerce\Blocks\BlockTypes\OrderConfirmation

AbstractOrderConfirmationBlock::email_verification_required()protectedWC 1.0

See if we need to verify the email address before showing the order details.

Method of the class: AbstractOrderConfirmationBlock{}

Return

true|false.

Usage

// protected - for code of main (parent) or child class
$result = $this->email_verification_required( $order );
$order(\WC_Order) (required)
Order object.

AbstractOrderConfirmationBlock::email_verification_required() code WC 8.9.0

protected function email_verification_required( $order ) {
	$session = wc()->session;

	// Skip verification if the current user still has the order in their session.
	if ( is_a( $session, \WC_Session::class ) && $order->get_id() === (int) $session->get( 'store_api_draft_order' ) ) {
		return false;
	}

	// Skip verification if the order was created within the grace period.
	if ( $this->is_within_grace_period( $order ) ) {
		return false;
	}

	// If the user verified their email address, we can skip further verification.
	if ( $this->is_email_verified( $order ) ) {
		return false;
	}

	/**
	 * Provides an opportunity to override the (potential) requirement for shoppers to verify their email address
	 * before we show information such as the order summary, or order payment page.
	 *
	 * @see \WC_Shortcode_Checkout::order_received()
	 * @since 11.4.0
	 * @param bool     $email_verification_required If email verification is required.
	 * @param WC_Order $order                       The relevant order.
	 * @param string   $context                     The context under which we are performing this check.
	 */
	return (bool) apply_filters( 'woocommerce_order_email_verification_required', true, $order, 'order-received' );
}