Skip to content

Instantly share code, notes, and snippets.

@csavoronin
Created March 17, 2023 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csavoronin/d554797a10593124a8a202f49c072e44 to your computer and use it in GitHub Desktop.
Save csavoronin/d554797a10593124a8a202f49c072e44 to your computer and use it in GitHub Desktop.
[!] {@32890}: Checkout: Profile fields: The shipping zipcode was filled with the zip code from the billing address. Fixed.
diff --git a/js/tygh/checkout/lite_checkout.js b/js/tygh/checkout/lite_checkout.js
index 6a404826a85..c10357aa372 100644
--- a/js/tygh/checkout/lite_checkout.js
+++ b/js/tygh/checkout/lite_checkout.js
@@ -355,8 +355,8 @@
setLocation: function(city, stateCode, state, zipcode) {
// update plain fields
$city.val(city);
- if ($zipCode.length) {
- $zipCode.val(zipcode ? zipcode : '');
+ if ($zipCode.length && typeof zipcode !== 'undefined' && typeof zipcode === 'string') {
+ $zipCode.val(zipcode);
}
methods.getElement('state').val(stateCode ? stateCode : state);
@@ -618,8 +618,6 @@
if (isCityChanged || isStateChanged || isCountryChanged) {
methods.setLocation(city, stateCode, state);
- } else if ($zipCode.length && ($zipCode.val() !== $zipCode.data('caLiteCheckoutLastValue'))) {
- methods.setLocation(city, stateCode, state, $zipCode.val());
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment