Ran into another interesting issue with a fairly customized WooCommerce checkout process.
In my case, I had some fields that were conditionally shown/hidden depending on the user’s previous choices. On checkout page load, all those fields were marked “required” in my backend using “woocommerce_checkout_fields” filter as usual. On form submit, in the same filter I would set them required or not required based on the user’s choices. This would work fine with WooCommerce, as their JS validator does not validate hidden fields. However, Stripe Checkout seems to validate them.
Based on some limited testing, this is the behavior of the extension:
- Run its own validator to check if any “validate-required” fields are empty. If yes, do not submit the form and show uninformative error message.
- Submit card details to Stripe, if failure then do not submit the form.
- Finally submit form to WooCommerce, display any errors from backend validation.
- Authorize payment (I assume)
Note that backend validation is done only after getting a confirmation from Stripe.
Solution: if you have any conditional fields you would like to mark “required”, just add/remove the “validate-required” class dynamically when you show/hide your conditional fields.