I'm trying to modify the checkout page. Using a plugin I was able to replace the two default address lines with a street, house number and 'extra' field (they're all on one line). Below that, you find the postcode and the city field.
However, I want to generate the street and city when the user enters their postcode and housenumber, so I want to switch the fields.
It's like this:
Street - Housenumber - Extra
Postcode - City
I want it to be:
Postcode - Housnumber - Extra
Street - City
I'm using the regular hook:
add_filter("woocommerce_checkout_fields", "order_fields");
function order_fields($fields) {
$order = array(
"billing_first_name",
"billing_last_name",
"billing_company",
"billing_street",
"billing_house_number",
"billing_house_number_extra",
"billing_postcode",
"billing_city",
"billing_country",
"billing_email",
"billing_phone"
);
foreach($order as $field)
{
$ordered_fields[$field] = $fields["billing"][$field];
}
$fields["billing"] = $ordered_fields;
return $fields;
}
However... trying to move the postcode field is unsuccesful. If I move the postcode and city field together I'm able to move them, but just trying to move the postcode field seperate shows strange behaviour (For instance: switching out the street and postcode field).
What am I missing?