Reorder checkout fields not working
-
I’m trying to change the order of the checkout fields with this code, but nothing happens
<div class="woocommerce-billing-fields"> <?php do_action('woocommerce_before_checkout_billing_form', $checkout); ?> <div class="woocommerce-billing-fields__field-wrapper"> <?php $fields = $checkout->get_checkout_fields('billing'); echo '<div class="woocommerce-billing-fields__row">'; woocommerce_form_field('billing_first_name', $fields['billing_first_name'], $checkout->get_value('billing_first_name')); woocommerce_form_field('billing_last_name', $fields['billing_last_name'], $checkout->get_value('billing_last_name')); woocommerce_form_field('billing_company', $fields['billing_company'], $checkout->get_value('billing_company')); echo '</div>'; echo '<div class="woocommerce-billing-fields__row">'; woocommerce_form_field('billing_country', $fields['billing_country'], $checkout->get_value('billing_country')); woocommerce_form_field('billing_city', $fields['billing_city'], $checkout->get_value('billing_city')); // woocommerce_form_field( 'billing_state', $fields['billing_state'], $checkout->get_value( 'billing_state' ) ); echo '</div>'; echo '<div class="woocommerce-billing-fields__row">'; woocommerce_form_field('billing_postcode', $fields['billing_postcode'], $checkout->get_value('billing_postcode')); woocommerce_form_field('billing_address_1', array( 'type' => 'text', 'label' => __('Ulica', 'pivnicacebovce'), 'placeholder' => __('', ''), 'required' => true, ), $checkout->get_value('billing_address_1')); woocommerce_form_field('billing_address_2', array( 'type' => 'text', 'label' => __('Čislo domu', 'pivnicacebovce'), 'placeholder' => __('', ''), 'required' => true, ), $checkout->get_value('billing_address_2')); echo '</div>'; echo '<div class="woocommerce-billing-fields__row">'; woocommerce_form_field('billing_phone', $fields['billing_phone'], $checkout->get_value('billing_phone')); woocommerce_form_field('billing_email', $fields['billing_email'], $checkout->get_value('billing_email')); echo '</div>'; // Unset fields you don't want to display unset( $fields['billing_first_name'] ); unset( $fields['billing_last_name'] ); unset( $fields['billing_company'] ); unset( $fields['billing_country'] ); unset( $fields['billing_city'] ); unset( $fields['billing_postcode'] ); unset( $fields['billing_address_1'] ); unset( $fields['billing_address_2'] ); unset( $fields['billing_phone'] ); unset( $fields['billing_email'] ); foreach ( $fields as $key => $field ) { woocommerce_form_field( $key, $field, $checkout->get_value( $key ) ); } ?> </div> <?php do_action('woocommerce_after_checkout_billing_form', $checkout); ?> </div>
Only wp_dequeue_script( ‘wc-checkout’ ); is helping but I need this scripts for ajax loading etc.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Reorder checkout fields not working’ is closed to new replies.