Automattic\WooCommerce\Blocks\BlockTypes\OrderConfirmation
AbstractOrderConfirmationBlock::is_email_verified()
Returns true if the email has been verified (posted email matches given order email).
Method of the class: AbstractOrderConfirmationBlock{}
No Hooks.
Return
true|false
.
Usage
// protected - for code of main (parent) or child class $result = $this->is_email_verified( $order );
- $order(\WC_Order) (required)
- Order object.
AbstractOrderConfirmationBlock::is_email_verified() AbstractOrderConfirmationBlock::is email verified code WC 9.6.1
protected function is_email_verified( $order ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash if ( empty( $_POST ) || ! isset( $_POST['email'], $_POST['_wpnonce'] ) ) { return false; } $nonce_value = sanitize_key( wp_unslash( $_POST['_wpnonce'] ?? '' ) ); if ( ! wp_verify_nonce( $nonce_value, 'wc_verify_email' ) && ! wp_verify_nonce( $nonce_value, 'wc_create_account' ) ) { return false; } return $order->get_billing_email() && sanitize_email( wp_unslash( $_POST['email'] ?? '' ) ) === $order->get_billing_email(); }