• Resolved ciechom

    (@ciechom)


    Hi
    Can you please advice how can I make EU VAT field read only on checkout ?
    In my case I would like to add VAT manually for each customer and do not want to allow them to change it during checkout.
    Prompt answer will be much appreciated ??

Viewing 1 replies (of 1 total)
  • Plugin Author Diego

    (@daigo75)

    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/

Viewing 1 replies (of 1 total)
  • The topic ‘EU VAT field -> read only on checkout’ is closed to new replies.