[woocommerce] ordering fields on my-account/edit-address/billing/
-
I have a WooCommerce site where I ask for some non standard billing information (Company Identificaiton Number)
I have succesfully created this feature and I am saving the data with other user_meta as billing_ci
Now when I view the edit Billing Address page this custom field is always shown at the bottom of the form. The logical place to have it would be either above or below the Company field.
I have googled hi and lo, and I just can’t seem to find a solution to rearrange those fields; at least one that works with the current version of WooCommerce.
Changing the order in /myaccount/my-address.php does not have an effect (I have copied the files over to my child theme this is just for directions)
same for class_wc_countries, this only affects the format on My Account and on checkout.
I’ve used this filter to add it, but does that mean I have to unset every field and then isset them again in correct order?
add_filter( 'woocommerce_address_to_edit', 'custom_address_to_edit' ); function custom_address_to_edit( $address ) { global $wp_query; if ( isset( $wp_query->query_vars['edit-address'] ) && $wp_query->query_vars['edit-address'] != 'billing' ) { return $address; } if ( ! isset( $address['billing_cvr'] ) ) { $address['billing_cvr'] = array( 'label' => __( 'CVR', 'woocommerce' ), 'placeholder' => _x( 'CVR', 'placeholder', 'woocommerce' ), 'required' => true, //change to false if you do not need this field to be required 'class' => array( 'form-row-first' ), 'clear' => true ); } return $address; }
- The topic ‘[woocommerce] ordering fields on my-account/edit-address/billing/’ is closed to new replies.