Trigger a country select on page load to ensure the address-i18n is fired on first page load.
This commit is contained in:
parent
d1c90c5972
commit
c0acd73d31
|
@ -6,8 +6,7 @@ jQuery( function( $ ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var locale_json = wc_address_i18n_params.locale.replace( /"/g, '"' ),
|
var locale_json = wc_address_i18n_params.locale.replace( /"/g, '"' ), locale = $.parseJSON( locale_json );
|
||||||
locale = $.parseJSON( locale_json );
|
|
||||||
|
|
||||||
function field_is_required( field, is_required ) {
|
function field_is_required( field, is_required ) {
|
||||||
if ( is_required ) {
|
if ( is_required ) {
|
||||||
|
@ -27,11 +26,8 @@ jQuery( function( $ ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$( document.body )
|
|
||||||
|
|
||||||
// Handle locale
|
// Handle locale
|
||||||
.bind( 'country_to_state_changing', function( event, country, wrapper ) {
|
$( document.body ).bind( 'country_to_state_changing', function( event, country, wrapper ) {
|
||||||
|
|
||||||
var thisform = wrapper, thislocale;
|
var thisform = wrapper, thislocale;
|
||||||
|
|
||||||
if ( typeof locale[ country ] !== 'undefined' ) {
|
if ( typeof locale[ country ] !== 'undefined' ) {
|
||||||
|
@ -129,4 +125,7 @@ jQuery( function( $ ) {
|
||||||
rows.detach().appendTo( wrapper );
|
rows.detach().appendTo( wrapper );
|
||||||
} );
|
} );
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
// Make sure the locales are loaded on first page load.
|
||||||
|
$( '#billing_country' ).trigger( 'change' );
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue