n 'full'; } return $this->is_current_customer_order( $order ) ? 'full' : false; } // Guest orders are displayed only within the grace period or after verification. If email verification is required, return false. return $this->email_verification_required( $order ) ? false : 'full'; } /** * See if guest checkout is enabled. * * @return boolean */ protected function allow_guest_checkout() { return 'yes' === get_option( 'woocommerce_enable_guest_checkout' ); } /** * Guest users without an active session can provide their email address to view order details. This however can only * be permitted if the user also provided the correct order key, and guest checkout is actually enabled. * * @param \WC_Order $order Order object. * @return boolean */ protected function email_verification_permitted( $order ) { return $this->allow_guest_checkout() && $this->has_valid_order_key( $order ) && ! $this->is_customer_order( $order ); } /** * See if the order was created within the grace period for viewing details. * * @param \WC_Order $order Order object. * @return boolean */ protected function is_within_grace_period( $order ) { /** * Controls the grace period within which we do not require any sort of email verification step before rendering * the 'order received' or 'order pay' pages. * * @see \WC_Shortcode_Checkout::order_received() * @since 11.4.0 * @param int $grace_period Time in seconds after an order is placed before email verification may be required. * @param \WC_Order $order The order for which this grace period is being assessed. * @param string $context Indicates the context in which we might verify the email address. Typically 'order-pay' or 'order-received'. */ $verification_grace_period = (int) apply_filters( 'woocommerce_order_email_verification_grace_period', 10 * MINUTE_IN_SECONDS, $order, 'order-received' ); $date_created = $order->get_date_created(); return is_a( $date_created, \WC_DateTime::class ) && time() - $date_created->getTimestamp() <= $verification_grace_period; } /** * Returns true if the email has been verified (posted email matches given order email). * * @param \WC_Order $order Order object. * @return boolean */ protected function is_email_verified( $order ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash if ( empty( $_POST ) || ! isset( $_POST['email'] ) || ! wp_verify_nonce( $_POST['check_submission'] ?? '', 'wc_verify_email' ) ) { return false; } return $order->get_billing_email() && sanitize_email( wp_unslash( $_POST['email'] ?? '' ) ) === $order->get_billing_email(); } /** * See if we need to verify the email address before showing the order details. * * @param \WC_Order $order Order object. * @return boolean */ 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' ); } /** * See if the order key is valid. * * @param \WC_Order $order Order object. * @return boolean */ protected function has_valid_order_key( $order ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended return ! empty( $_GET['key'] ) && $order->key_is_valid( wc_clean( wp_unslash( $_GET['key'] ) ) ); } /** * See if the current order came from a guest or a logged in customer. * * @param \WC_Order $order Order object. * @return boolean */ protected function is_customer_order( $order ) { return 0 < $order->get_user_id(); } /** * See if the current logged in user ID matches the given order customer ID. * * Returns false for logged-out customers. * * @param \WC_Order $order Order object. * @return boolean */ protected function is_current_customer_order( $order ) { return $this->is_customer_order( $order ) && $order->get_user_id() === get_current_user_id(); } /** * Get the frontend script handle for this block type. * * @param string $key Data to get, or default to everything. */ protected function get_block_type_script( $key = null ) { return null; } /** * Register block pattern for Order Confirmation to make it translatable. */ public function register_patterns() { register_block_pattern( 'woocommerce/order-confirmation-totals-heading', array( 'title' => '', 'inserter' => false, 'content' => '

' . esc_html__( 'Order details', 'woocommerce' ) . '

', ) ); register_block_pattern( 'woocommerce/order-confirmation-downloads-heading', array( 'title' => '', 'inserter' => false, 'content' => '

' . esc_html__( 'Downloads', 'woocommerce' ) . '

', ) ); register_block_pattern( 'woocommerce/order-confirmation-shipping-heading', array( 'title' => '', 'inserter' => false, 'content' => '

' . esc_html__( 'Shipping address', 'woocommerce' ) . '

', ) ); register_block_pattern( 'woocommerce/order-confirmation-billing-heading', array( 'title' => '', 'inserter' => false, 'content' => '

' . esc_html__( 'Billing address', 'woocommerce' ) . '

', ) ); register_block_pattern( 'woocommerce/order-confirmation-additional-fields-heading', array( 'title' => '', 'inserter' => false, 'content' => '

' . esc_html__( 'Additional information', 'woocommerce' ) . '

', ) ); } /** * Render custom fields for the order. * * @param array $fields List of additional fields with values. * @return string */ protected function render_additional_fields( $fields ) { if ( empty( $fields ) ) { return ''; } return '
' . implode( '', array_map( array( $this, 'render_additional_field' ), $fields ) ) . '
'; } /** * Render custom field row. * * @param array $field An additional field and value. * @return string */ protected function render_additional_field( $field ) { return sprintf( '
%1$s
%2$s
', esc_html( $field['label'] ), esc_html( $field['value'] ) ); } }
Fatal error: Uncaught Error: Class "Automattic\WooCommerce\Blocks\BlockTypes\OrderConfirmation\AbstractOrderConfirmationBlock" not found in /htdocs/wp-content/plugins/woocommerce/src/Blocks/BlockTypes/OrderConfirmation/Status.php:10 Stack trace: #0 /htdocs/wp-content/plugins/woocommerce-services/vendor/jetpack-autoloader/class-php-autoloader.php(90): require() #1 /htdocs/wp-content/plugins/woocommerce/src/Blocks/BlockTypesController.php(107): Automattic\Jetpack\Autoloader\jp77cdada645cf40f25c2589337309d30d\al3_0_2\PHP_Autoloader::load_class('Automattic\\WooC...') #2 /htdocs/wp-includes/class-wp-hook.php(324): Automattic\WooCommerce\Blocks\BlockTypesController->register_blocks('') #3 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #4 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #5 /htdocs/wp-settings.php(695): do_action('init') #6 /htdocs/wp-config.php(98): require_once('/htdocs/wp-sett...') #7 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #8 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #9 /htdocs/index.php(17): require('/htdocs/wp-blog...') #10 {main} thrown in /htdocs/wp-content/plugins/woocommerce/src/Blocks/BlockTypes/OrderConfirmation/Status.php on line 10