Show basic validation error only for required fields

Otherwise it may trigger on some sites when the field is no longer required but still marked as invalid, e.g. after switching to a country without required state
This commit is contained in:
Alex P 2022-07-01 11:37:18 +03:00
parent 1558f05361
commit 7f42fe1882

View file

@ -38,7 +38,7 @@ const bootstrap = () => {
requiredFields.each((i, input) => {
jQuery(input).trigger('validate');
});
if (jQuery('form.woocommerce-checkout .woocommerce-invalid:visible').length) {
if (jQuery('form.woocommerce-checkout .validate-required.woocommerce-invalid:visible').length) {
errorHandler.clear();
errorHandler.message(PayPalCommerceGateway.labels.error.js_validation);