Magento Asked by Shorabh on December 12, 2021
I have use extension https://github.com/EaDesgin/Magento2-City-Dropdown to show city in dropdown but when I enable this extension, city is showing blank in address section of checkout payment page.
If I tap on “Place order” button then it shows below error:
Please check the billing address information. city is a required field
You need to rewrite and add the following validations to these js files:
magento/vendor/eadesignro/romcity/view/frontend/web/js/action/set-shipping-information-mixin.js:15
if (shippingCityIdValue.length) {
shippingAddress.city = shippingCityIdValue;
}
magento/vendor/eadesignro/romcity/view/frontend/web/js/view/billing-address.js:62
Replace
if (this.isAddressSameAsShipping()) {
newAddress.city = shippingCityIdValue;
} else if (billingAddressCity) {
newAddress.city = billingAddressCity.text();
} else {
newAddress.city = shippingCityIdValue;
}
with:
if (shippingCityIdValue) {
newAddress.city = shippingCityIdValue;
}
if (!this.isAddressSameAsShipping() && billingAddressCity && billingAddressCity.text()) {
newAddress.city = billingAddressCity.text();
}
It seems that they try to add the city from the form but the values are not present anymore when you already have an address set.
Answered by Magarusu on December 12, 2021
Please check this file in your theme:
Magento_Checkout/web/template/shipping-information/address-renderer/default.html
City Should be remove from there, if yes then please add below code:-
<!-- ko text: address().city --><!-- /ko -->
Then File should be look like this:-
<div class="shipping-address-item" data-bind="css: isSelected() ? 'selected-item' : 'not-selected-item'">
<!-- ko text: address().prefix --><!-- /ko --> <!-- ko text: address().firstname --><!-- /ko -->
<!-- ko text: address().lastname --><!-- /ko --> <!-- ko text: address().suffix --><!-- /ko --><br/>
<!-- ko text: address().street --><!-- /ko --><br/>
<!-- ko text: address().city --><!-- /ko -->, <!-- ko text: address().region --><!-- /ko --> <!-- ko text: address().postcode --><!-- /ko --><br/>
<!-- ko text: getCountryName(address().countryId) --><!-- /ko --><br/>
<!-- ko text: address().telephone --><!-- /ko --><br/>
<!-- ko foreach: { data: address().customAttributes, as: 'element' } -->
<!-- ko foreach: { data: Object.keys(element), as: 'attribute' } -->
<!-- ko text: element[attribute].value --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
<!-- ko if: (address().isEditable()) -->
<button type="button"
class="action edit-address-link"
data-bind="click: editAddress, visible: address().isEditable()">
<span data-bind="i18n: 'Edit'"></span>
</button>
<!-- /ko -->
<button type="button" data-bind="click: selectAddress" class="action action-select-shipping-item">
<span data-bind="i18n: 'Ship Here'"></span>
</button>
</div>
Answered by temper on December 12, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP