Skip to content

Commit

Permalink
MAGETWO-63200: State field is not required on checkout even though it…
Browse files Browse the repository at this point in the history
… is configured to be
  • Loading branch information
Sergii Kovalenko committed Mar 1, 2017
1 parent 8c91c87 commit 4f2fa65
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/code/Magento/Ui/view/base/web/js/form/element/region.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ define([
update: function (value) {
var country = registry.get(this.parentName + '.' + 'country_id'),
options = country.indexedOptions,
isRegionRequired,
option;

if (!value) {
Expand All @@ -43,6 +44,14 @@ define([
this.validation['required-entry'] = true;
}

if (option && !this.options().length) {
registry.get(this.customName, function (input) {
isRegionRequired = !!option['is_region_required'];
input.validation['required-entry'] = isRegionRequired;
input.required(isRegionRequired);
});
}

this.required(!!option['is_region_required']);
}
},
Expand Down

0 comments on commit 4f2fa65

Please sign in to comment.