Skip to content

Commit 4122c40

Browse files
committed
Cleaning inputs value before the checks
1 parent 849a267 commit 4122c40

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

app/code/Magento/Checkout/view/frontend/web/js/region-updater.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ define([
164164

165165
// Populate state/province dropdown list if available or use input box
166166
if (this.options.regionJson[country]) {
167+
$(regionList).find('option:selected').removeAttr("selected");
167168
this._removeSelectOptions(regionList);
168169
$.each(this.options.regionJson[country], $.proxy(function (key, value) {
169170
this._renderSelectOption(regionList, key, value);
@@ -198,6 +199,7 @@ define([
198199
regionInput.hide();
199200
label.attr('for', regionList.attr('id'));
200201
} else {
202+
regionInput.val('');
201203
this._removeSelectOptions(regionList);
202204

203205
if (this.options.isRegionRequired) {
@@ -224,13 +226,7 @@ define([
224226
postcode.addClass('required-entry').closest('.field').addClass('required');
225227
}
226228

227-
if (!this.options.defaultRegion) {
228-
regionList.val('');
229-
regionInput.val('');
230-
} else {
231-
// Add defaultvalue attribute to state/province select element
232-
regionList.attr('defaultvalue', this.options.defaultRegion);
233-
}
229+
regionList.attr('defaultvalue', this.options.defaultRegion);
234230
},
235231

236232
/**

0 commit comments

Comments
 (0)