diff --git a/assets/js/admin/meta-boxes-order.js b/assets/js/admin/meta-boxes-order.js
index fb59bdc9598..1341860cbbb 100644
--- a/assets/js/admin/meta-boxes-order.js
+++ b/assets/js/admin/meta-boxes-order.js
@@ -53,22 +53,34 @@ jQuery( function ( $ ) {
$parent.show().find( '.select2-container' ).remove();
if ( ! $.isEmptyObject( wc_meta_boxes_order.states[ country ] ) ) {
- var $states_select = $( '' ),
- state = wc_meta_boxes_order.states[ country ];
+ var state = wc_meta_boxes_order.states[ country ],
+ $newstate = $( '' )
+ .prop( 'id', input_id )
+ .prop( 'name', input_name )
+ .prop( 'placeholder', placeholder )
+ .addClass( 'js_field-state select short' )
+ .append( $( '' ) );
- $states_select.append( $( '' ) );
+ $.each( state, function( index ) {
+ var $option = $( '' )
+ .prop( 'value', index )
+ .text( state[ index ] );
+ $newstate.append( $option );
+ } );
- $.each( state, function( index ) {
- $states_select.append( $( '' ) );
- } );
+ $newstate.val( value );
- $states_select.val( value );
+ $state.replaceWith( $newstate );
- $state.replaceWith( $states_select );
-
- $states_select.show().selectWoo().hide().change();
+ $newstate.show().selectWoo().hide().change();
} else {
- $state.replaceWith( '' );
+ var $newstate = $( '' )
+ .prop( 'id', input_id )
+ .prop( 'name', input_name )
+ .prop( 'placeholder', placeholder )
+ .addClass( 'js_field-state' )
+ .val( value );
+ $state.replaceWith( $newstate );
}
// This event has a typo - deprecated in 2.5.0