From f20e8ab567f611fceb4b05d41b658c232a398288 Mon Sep 17 00:00:00 2001 From: Alfredo Sumaran Date: Mon, 17 May 2021 18:26:16 -0500 Subject: [PATCH] Move variable declaration outside foreach loop --- includes/class-wc-checkout.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class-wc-checkout.php b/includes/class-wc-checkout.php index ef46e957905..6909110edeb 100644 --- a/includes/class-wc-checkout.php +++ b/includes/class-wc-checkout.php @@ -679,14 +679,14 @@ class WC_Checkout { // phpcs:enable WordPress.Security.NonceVerification.Missing $skipped = array(); + $form_was_shown = isset( $_POST['woocommerce-process-checkout-nonce'] ); + foreach ( $this->get_checkout_fields() as $fieldset_key => $fieldset ) { if ( $this->maybe_skip_fieldset( $fieldset_key, $data ) ) { $skipped[] = $fieldset_key; continue; } - $form_was_shown = isset( $_REQUEST['woocommerce-process-checkout-nonce'] ); - foreach ( $fieldset as $key => $field ) { $type = sanitize_title( isset( $field['type'] ) ? $field['type'] : 'text' );