diff --git a/assets/js/frontend/address-i18n.js b/assets/js/frontend/address-i18n.js index b2df389d362..6ab1bfbeda2 100644 --- a/assets/js/frontend/address-i18n.js +++ b/assets/js/frontend/address-i18n.js @@ -101,6 +101,10 @@ jQuery( function( $ ) { field.show(); } } + + // Class changes. + field.removeClass( 'form-row-first form-row-last form-row-wide' ); + field.addClass( fieldLocale.class.join( ' ' ) ); }); var fieldsets = $( diff --git a/includes/class-wc-countries.php b/includes/class-wc-countries.php index 871f0f2505a..b3e045136f3 100644 --- a/includes/class-wc-countries.php +++ b/includes/class-wc-countries.php @@ -516,7 +516,7 @@ class WC_Countries { 'DK' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}", 'FR' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city_upper}\n{country}", 'HK' => "{company}\n{first_name} {last_name_upper}\n{address_1}\n{address_2}\n{city_upper}\n{state_upper}\n{country}", - 'HU' => "{name}\n{company}\n{city}\n{address_1}\n{address_2}\n{postcode}\n{country}", + 'HU' => "{last_name} {first_name}\n{company}\n{city}\n{address_1}\n{address_2}\n{postcode}\n{country}", 'IN' => "{company}\n{name}\n{address_1}\n{address_2}\n{city} {postcode}\n{state}, {country}", 'IS' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}", 'IT' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode}\n{city}\n{state_upper}\n{country}", @@ -982,6 +982,27 @@ class WC_Countries { ), ), 'HU' => array( + 'last_name' => array( + 'class' => array( 'form-row-first' ), + 'priority' => 10, + ), + 'first_name' => array( + 'class' => array( 'form-row-last' ), + 'priority' => 20, + ), + 'postcode' => array( + 'class' => array( 'form-row-first', 'address-field' ), + 'priority' => 65, + ), + 'city' => array( + 'class' => array( 'form-row-last', 'address-field' ), + ), + 'address_1' => array( + 'priority' => 71, + ), + 'address_2' => array( + 'priority' => 72, + ), 'state' => array( 'label' => __( 'County', 'woocommerce' ), ), @@ -1040,12 +1061,12 @@ class WC_Countries { 'priority' => 20, ), 'postcode' => array( - 'class' => array( 'form-row-first' ), + 'class' => array( 'form-row-first', 'address-field' ), 'priority' => 65, ), 'state' => array( 'label' => __( 'Prefecture', 'woocommerce' ), - 'class' => array( 'form-row-last' ), + 'class' => array( 'form-row-last', 'address-field' ), 'priority' => 66, ), 'city' => array( diff --git a/includes/class-wc-validation.php b/includes/class-wc-validation.php index 4bdd0931d66..d6144e54bfa 100644 --- a/includes/class-wc-validation.php +++ b/includes/class-wc-validation.php @@ -70,6 +70,9 @@ class WC_Validation { case 'GB': $valid = self::is_gb_postcode( $postcode ); break; + case 'HU': + $valid = (bool) preg_match( '/^([0-9]{4})$/i', $postcode ); + break; case 'IE': $valid = (bool) preg_match( '/([AC-FHKNPRTV-Y]\d{2}|D6W)[0-9AC-FHKNPRTV-Y]{4}/', wc_normalize_postcode( $postcode ) ); break;