Hello,
I can validate the PostCode on checkout page by changing the file app/design/frontend/Theme/Magento_Checkout/layout/checkout_index_index.xml with the code :
<item name="postcode" xsi:type="array">
<item name="sortOrder" xsi:type="string">75</item>
<item name="component" xsi:type="string">Magento_Ui/js/form/element/post-code</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="string">true</item>
<item name="validate-zip-us" xsi:type="string">true</item>
</item>
</item>
But this code not reflected on Edit Customer address page in address book(in my account).
Can anyone suggest me solution on this issue.
Solved! Go to Solution.
Hi @varshanema519b ,
You need to overright vendor/magento/module-customer/view/frontend/templates/address/edit.phtml to modify or add new validation for zipcode.
In this file you can find below code:
<input type="text"
name="postcode"
value="<?= $escaper->escapeHtmlAttr($block->getAddress()->getPostcode()) ?>"
title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('postcode') ?>"
id="zip"
class="input-text validate-zip-international
<?= $escaper->escapeHtmlAttr($_postcodeValidationClass) ?>">
You can modify class validation in your over righted file.
Problem Solved? Accept as Solution!
Hope it helps!
Thanks
Hi @varshanema519b ,
You need to overright vendor/magento/module-customer/view/frontend/templates/address/edit.phtml to modify or add new validation for zipcode.
In this file you can find below code:
<input type="text"
name="postcode"
value="<?= $escaper->escapeHtmlAttr($block->getAddress()->getPostcode()) ?>"
title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('postcode') ?>"
id="zip"
class="input-text validate-zip-international
<?= $escaper->escapeHtmlAttr($_postcodeValidationClass) ?>">
You can modify class validation in your over righted file.
Problem Solved? Accept as Solution!
Hope it helps!
Thanks
Hello ,
How can I validate Postcode at change shipping address in my subscription page in My account ?