Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Woo checkout form validation #343

Closed
crftwrk opened this issue Jan 3, 2023 · 0 comments · Fixed by #557
Closed

Refactor Woo checkout form validation #343

crftwrk opened this issue Jan 3, 2023 · 0 comments · Fixed by #557

Comments

@crftwrk
Copy link
Member

crftwrk commented Jan 3, 2023

.woocommerce-invalid .form-control {
  @extend .is-invalid;
}

.woocommerce-validated .form-control {
  @extend .is-valid;
}

Much more better than

// Checkout Form Validation
$('body').on('blur change', '.form-row input', function () {
  $('.woocommerce form .form-row.woocommerce-validated .select2-container, .woocommerce form .form-row.woocommerce-validated input.input-text, .woocommerce form .form-row.woocommerce-validated select, .woocommerce form .form-row.woocommerce-validated .form-check-input[type=checkbox]').removeClass('is-invalid').addClass('is-valid');
  $('.woocommerce form .form-row.woocommerce-invalid .select2-container, .woocommerce form .form-row.woocommerce-invalid input.input-text, .woocommerce form .form-row.woocommerce-invalid select, .woocommerce form .form-row.woocommerce-invalid .form-check-input[type=checkbox]').removeClass('is-valid').addClass('is-invalid');
});

We can do this after #329 is merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant