Woocommerce change field position in checkout page

Viewed 8505

I'm creating a custom field for billing section in checkout page, i see in source a data-priority attribute, but i don't know how to move my field to after Primary Name & Last Name

My billing form

Billing form

The code displayed on Chrome Dev Tools

Code

In simple words, I need to move the field to top.

3 Answers

Try this:

    function custom_field( $fields ) {
       $fields['billing']['RUT'] = array(
           'priority'   => 20 //or the number on position you what
            );
       return $fields;
    }
    add_filter( 'woocommerce_checkout_fields' , 'custom_field');
Related