Hi there,
Is it possible to make the EU VAT field required after selecting an option in a selectbox? My code right now is:
function change_billingcompany_vatnumber($fields) {
if ($_POST['afreg_select_user_role'] === 'wholesale_customer') {
$fields['billing']['billing_company']['required'] = true;
$fields['billing']['billing_eu_vat_number']['required'] = true;
} else {
$fields['billing']['billing_company']['required'] = false;
$fields['billing']['billing_eu_vat_number']['required'] = false;
}
return $fields;
}
add_filter('woocommerce_checkout_fields', 'change_billingcompany_vatnumber', 20);
Thanks!
-
This topic was modified 1 year, 2 months ago by
Omar Dabbas.