Hi,
I want to add validation to zip code in the checkout.
I've edited the code in design\themes\responsive\templates\views\profiles\components\profiles_scripts.tpl
<script>
(function(_, $) {
/* Do not put this code to document.ready, because it should be
initialized first
*/
$.ceRebuildStates('init', {
default_country: '{$settings.Checkout.default_country|escape:javascript}',
states: {$states|json_encode nofilter}
});
{literal}
$.ceFormValidator('setZipcode', {
US: {
regexp: /^(\d{5})(-\d{4})?$/,
format: '01342 (01342-5678)'
},
CA: {
regexp: /^(\w{3} ?\w{3})$/,
format: 'K1A OB1 (K1AOB1)'
},
RU: {
regexp: /^(\d{6})?$/,
format: '123456'
},
PL: {
regexp: /^(\d{2})(-\d{3})?$/,
format: '01342 (01342-5678)'
}
});
{/literal}
}(Tygh, Tygh.$));
</script>
And according to the docs (https://docs.cs-cart.com/latest/developer_guide/core/front-end/microformats.html) I should add class to label cm-zipcode? Should I do this directly in the unitheme? If yes, then which file should I edit? I'm stuck with this one and would appreciate the help!
Thanks in advance!