The VAT number field is added using a filter attached to the hook woocommerce_checkout_fields
. You can write your own custom filter and modify the list of fields as you need.
We don’t have a tested example of how to make the field read only (these customisations are outside the scope of our support service), but you could try with something like the following:
add_filter('woocommerce_checkout_fields', function($fields) {
$fields['billing']['vat_number']['custom_attributes']['readonly'] = 'readonly';
return $fields;
}, 50);
This should set the readonly
attribute against the field, preventing users from entering an arbitrary value.
For more information about altering the checkout fields, please refer to the official WooCommerce documentation on the subject: https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/