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.

Метод класса: AbstractOrderConfirmationBlock{}

Возвращает

true|false.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->email_verification_required( $order );
$order(\WC_Order) (обязательный)
Order object.

Код AbstractOrderConfirmationBlock::email_verification_required() WC 9.6.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' );
}