How to Rearrange Checkout Fields of WooCommerce?

You can customize checkout fields using WooCommerce actions and filters. If you want to Rearrange Checkout Fields then you have to follow the steps given below and make modifications in your WooCommerce theme.

Rearrange Checkout Fields

To Rearrange Checkout Fields you need to add the following lines of code in your theme's functions.php file. Just append the following lines of code at the bottom of  functions.php

// for billing fields

    add_filter("woocommerce_checkout_fields", "magik_new_billing_order_fields");

        function magik_new_billing_order_fields($fields) {

              $order = array(
               "billing_company", 
                "billing_first_name", 
                "billing_last_name", 

                "billing_address_1", 
                "billing_address_2", 
                "billing_postcode", 
                "billing_country", 
                "billing_email", 
                "billing_phone"

            );
             foreach($order as $field)
             {
                $ordered_fields[$field] = $fields["billing"][$field];
             }

            $fields["billing"] = $ordered_fields;
            return $fields;

        }

 // for shipping fields

     add_filter("woocommerce_checkout_fields", "magik_new_shiping_order_fields");

        function magik_new_shiping_order_fields($fields) {

                $order = array(   
                "shipping_city", 
                "shipping_postcode", 
                "shipping_country",    
                "shipping_first_name", 
                "shipping_last_name", 
                "shipping_company", 
                "shipping_address_1", 
                "shipping_address_2"

            );
            foreach($order as $field)
            {
                $ordered_fields[$field] = $fields["shipping"][$field];
            }

            $fields["shipping"] = $ordered_fields;
            return $fields;

        }

If you face any problems or need our professional services, please email us at [email protected]

Join our Newsletter

Never miss the latest offers, voucher codes and useful articles delivered weekly in your inbox.