I've created several new checkout fields for my checkout page.
One field is the first radio button with "type klant" this lets the user choose between customer type (business or private). When either is selected, some fields are hidden/shown by me with Javascript.
The "bedrijfsnaam" (business name) field is shown when "bedrijf" (business) is selected, it is not required. If made required and the user selects "particulier" (private) the field is not hidden with js, but present html-wise, so when completing, the validation gives an error to enter the business name.
How can I change the validation to only check the business name field when business is selected in customer type?
I probably have to do something with the do_action( 'woocommerce_before_checkout_process' );
to make the required check based on the radio button, but I got stuck there, any clues?
Thanks!