Archived topic
billing state field not moving
3 replies · Started by Rudie on February 15, 2019
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?
Woocommerce server configurations can have quite specific needs. I have seen Woocommerce support has a few questions regarding slow loading of products with multiple variations. Most of which direct the user to check out the servers Suhosin configuration. Not sure but might be a good place to start: