07-27-2023, 11:42 AM
For some reason, all the fields in Billing Address are marked as optional - customers are leaving the billing address fields blank and then their payments are being rejected (by Square, who is our payment processor).
I cannot find anywhere to make these fields required, and cannot figure out why they would be marked as optional in any case.
Can someone point me in the right direction?
UPDATE
I've even tried the following:
add_filter('woocommerce_billing_fields', 'force_billing_fields', 1000, 1);
function force_billing_fields($fields) {
$fields['billing_first_name']['required'] = true;
$fields['billing_last_name']['required'] = true;
$fields['billing_address_1']['required'] = true;
$fields['billing_city']['required'] = true;
$fields['billing_postcode']['required'] = true;
$fields['billing_country']['required'] = true;
$fields['billing_state']['required'] = true;
$fields['billing_email']['required'] = true;
$fields['billing_phone']['required'] = true;
return $fields;
}
And they're still marked as optional, except the billing phone and country are now marked as required. But the rest are still optional.
I cannot find anywhere to make these fields required, and cannot figure out why they would be marked as optional in any case.
Can someone point me in the right direction?
UPDATE
I've even tried the following:
add_filter('woocommerce_billing_fields', 'force_billing_fields', 1000, 1);
function force_billing_fields($fields) {
$fields['billing_first_name']['required'] = true;
$fields['billing_last_name']['required'] = true;
$fields['billing_address_1']['required'] = true;
$fields['billing_city']['required'] = true;
$fields['billing_postcode']['required'] = true;
$fields['billing_country']['required'] = true;
$fields['billing_state']['required'] = true;
$fields['billing_email']['required'] = true;
$fields['billing_phone']['required'] = true;
return $fields;
}
And they're still marked as optional, except the billing phone and country are now marked as required. But the rest are still optional.