Sometimes it is helpful if there is an extra field for the house number (the alternative is to check within the address field whether there is a number).
There are two variants for an extra field:
1.) If the address field 2 is not used, you can activate it under Customize > WooCommerce > Checkout > Address 2 Field and change it to the house number field.
add_filter( 'woocommerce_default_address_fields' , 'change_rename_address_placeholders_checkout', 9999 ); function change_rename_address_placeholders_checkout( $address_fields ) { $address_fields['address_1']['placeholder'] = 'Street Name'; $address_fields['address_2']['placeholder'] = 'House Number'; return $address_fields; }
2.) If address field 2 is already in use, the following solution will help.
add_filter( 'woocommerce_checkout_fields' , 'change_add_field_and_reorder_fields' ); function change_add_field_and_reorder_fields( $fields ) { // Add New Fields $fields['billing']['billing_houseno'] = array( 'label' => 'House Number', 'placeholder' => 'House Number', 'priority' => 51, 'required' => true, 'clear' => true ); $fields['shipping']['shipping_houseno'] = array( 'label' => 'House Number', 'placeholder' => 'House Number', 'priority' => 51, 'required' => true, 'clear' => true ); return $fields; } // ------------------------------------ // Add Billing House # to Address Fields add_filter( 'woocommerce_order_formatted_billing_address' , 'change_default_billing_address_fields', 10, 2 ); function change_default_billing_address_fields( $fields, $order ) { $fields['billing_houseno'] = get_post_meta( $order->get_id(), '_billing_houseno', true ); return $fields; } // ------------------------------------ // Add Shipping House # to Address Fields add_filter( 'woocommerce_order_formatted_shipping_address' , 'change_default_shipping_address_fields', 10, 2 ); function change_default_shipping_address_fields( $fields, $order ) { $fields['shipping_houseno'] = get_post_meta( $order->get_id(), '_shipping_houseno', true ); return $fields; } // ------------------------------------ // Create 'replacements' for new Address Fields add_filter( 'woocommerce_formatted_address_replacements', 'add_new_replacement_fields',10,2 ); function add_new_replacement_fields( $replacements, $address ) { $replacements['{billing_houseno}'] = isset($address['billing_houseno']) ? $address['billing_houseno'] : ''; $replacements['{shipping_houseno}'] = isset($address['shipping_houseno']) ? $address['shipping_houseno'] : ''; return $replacements; } // ------------------------------------ // Show Shipping & Billing House # for different countries add_filter( 'woocommerce_localisation_address_formats', 'change_new_address_formats' ); function change_new_address_formats( $formats ) { $formats['IE'] = "{name}\n{company}\n{address_1}\n{billing_houseno}\n{shipping_houseno}\n{city}\n{state}\n{postcode}\n{country}"; $formats['UK'] = "{name}\n{company}\n{address_1}\n{billing_houseno}\n{shipping_houseno}\n{city}\n{state}\n{postcode}\n{country}"; // and so on... return $formats; }