How can I restrict only alphabet characters in the billing first name, billing last name, shipping first name and shipping last name in WooCommerce checkout?
I am trying the following in the my Child Theme's functions.php file and it is causing the checkout section to not appear when I go to checkout in WooCommerce. Please advise.
add_filter('woocommerce_checkout_fields', 'custom_override_checkout_fields');
function custom_override_checkout_fields($fields) {
$fields['billing']['billing_first_name'] = array(
'label' => __('First name', 'woocommerce'),
'placeholder' => _x('First name', 'placeholder', 'woocommerce'),
'required' => false,
'clear' => false,
'type' => 'text',
'class' => array(
'alpha'
)
);
}
return $fields;
at the end of the function? – Spartacusreturn $fields
before the final closing curly brace of thecustom_override_checkout_fields
function. – Spartacus