Apply patch by @dtwist

This commit is contained in:
Gerhard 2019-08-02 14:19:37 +02:00
parent 27689ba0ca
commit 34e883ce81
1 changed files with 6 additions and 3 deletions

View File

@ -43,11 +43,11 @@ jQuery( function ( $ ) {
var $this = $( this ),
country = $this.val(),
$state = $this.parents( 'div.edit_address' ).find( ':input.js_field-state' ),
$stateValue = $state.val(),
$parent = $state.parent(),
stateValue = $state.val(),
input_name = $state.attr( 'name' ),
input_id = $state.attr( 'id' ),
value = $this.data( 'woocommerce.stickState-' + country ) ? $this.data( 'woocommerce.stickState-' + country ) : $stateValue,
value = $this.data( 'woocommerce.stickState-' + country ) ? $this.data( 'woocommerce.stickState-' + country ) : stateValue,
placeholder = $state.attr( 'placeholder' ),
$newstate;
@ -74,6 +74,9 @@ jQuery( function ( $ ) {
var $option = $( '<option></option>' )
.prop( 'value', index )
.text( state[ index ] );
if ( index == stateValue ) {
$option.prop( 'selected' );
}
$newstate.append( $option );
} );
@ -88,7 +91,7 @@ jQuery( function ( $ ) {
.prop( 'name', input_name )
.prop( 'placeholder', placeholder )
.addClass( 'js_field-state' )
.val( $stateValue );
.val( stateValue );
$state.replaceWith( $newstate );
}