Site logo

Archived topic

billing state field not moving

3 replies · Started by Rudie on February 15, 2019

Viewing posts 1–4 of 4

I am editing the checkout fields. I cant get the billing state field to be set under billing country. I tried writing functions in the themes functions.php file. Billing state field does not respond to any priority changes at all.

Screenshot: https://imgur.com/a/zi5tqVx

Hi there,

try this PHP filter:

add_filter( 'woocommerce_default_address_fields', 'db_reorder_checkout_fields' );
  
function db_reorder_checkout_fields( $fields ) {
 
    // default priorities: 
    // 'first_name' - 10
    // 'last_name' - 20
    // 'company' - 30
    // 'country' - 40
    // 'address_1' - 50
    // 'address_2' - 60
    // 'city' - 70
    // 'state' - 80
    // 'postcode' - 90
 
  $fields['state']['priority'] = 45;
 
  return $fields;
}

Left the default priorities in the comments to aid with their positioning.

Thank you David, this worked!

We also have a problem with slow variable products, to load a product page with 10 variations (size) took 36sec. This is what slow debug bar says:

Slow Actions
Action or Filter Callbacks Calls Per Call Total
woocommerce_single_product_summary 9 1 35662.07ms 35662.07ms
woocommerce_variable_add_to_cart 2 1 33022.71ms 33022.71ms

While this is a litespeed server with Redis enabled, how is this possible?

This archived topic is closed to new replies.