Skip to content

Commit dfbdad4

Browse files
committed
MAGETWO-66627: [GitHub] Default Post Code is applied for all Order's addresses if zip is not required
1 parent e5e8e2b commit dfbdad4

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

app/code/Magento/Checkout/view/frontend/web/js/model/default-post-code-resolver.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,35 @@
33
* See COPYING.txt for license details.
44
*/
55
define([], function () {
6+
'use strict';
7+
68
/**
79
* Define necessity of using default post code value
810
*/
911
var useDefaultPostCode;
1012

1113
return {
12-
1314
/**
1415
* Resolve default post code
1516
*
16-
* @returns {string|undefined}
17+
* @returns {String|undefined}
1718
*/
18-
resolve: function () {
19+
resolve: function ()
20+
{
1921
return useDefaultPostCode ? window.checkoutConfig.defaultPostcode : undefined;
2022
},
2123

2224
/**
2325
* Set state to useDefaultPostCode variable
2426
*
25-
* @param shouldUseDefaultPostCode
27+
* @param {Boolean} shouldUseDefaultPostCode
2628
* @returns {underscore}
2729
*/
2830
setUseDefaultPostCode: function (shouldUseDefaultPostCode)
2931
{
3032
useDefaultPostCode = shouldUseDefaultPostCode;
33+
3134
return this;
3235
}
3336
};
34-
});
37+
});

app/code/Magento/Ui/view/base/web/js/form/element/region.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ define([
1111
'uiRegistry',
1212
'./select',
1313
'Magento_Checkout/js/model/default-post-code-resolver'
14-
], function (_, registry, Select, DefaultPostCodeResolver) {
14+
], function (_, registry, Select, defaultPostCodeResolver) {
1515
'use strict';
1616

1717
return Select.extend({
@@ -35,9 +35,10 @@ define([
3535
return;
3636
}
3737
option = options[value];
38-
DefaultPostCodeResolver
39-
.setUseDefaultPostCode('undefined' !== typeof option.is_zipcode_optional &&
40-
true === option.is_zipcode_optional ? false : true);
38+
defaultPostCodeResolver
39+
.setUseDefaultPostCode(typeof option.is_zipcode_optional !== 'undefined'&&
40+
option.is_zipcode_optional === true ? false : true);
41+
4142
if (this.skipValidation) {
4243
this.validation['required-entry'] = false;
4344
this.required(false);

0 commit comments

Comments
 (0)