Top WooCommerce & WordPress Plugins › Forums › EU/UK VAT Manager for WooCommerce › eu vat billing read only
- Support forum for the EU VAT Manager for WooCommerce.
- This topic has 1 reply, 2 voices, and was last updated 6 months, 3 weeks ago by
Omar.
- AuthorPosts
- May 15, 2023 at 1:23 pm #115335
Fabio Tielen
ParticipantHello
We want to make to make the eu vat billing field readonly.
We have a custom registration process where clients get an invitation from admin and the admin setup all the account information after validating the new client.In the checkout the client can change VAT number which we don’t want.
We are using a code snippet to prevent changing all the fields required, and this works fine except the vat field from your plugin is not changing behaviour.
We are using this code snippet:
add_filter( ‘woocommerce_checkout_fields’ , ‘make_fields_readonly’ );
function make_fields_readonly( $fields ) {
$fields[‘billing’][‘billing_company’][‘custom_attributes’] = array( ‘readonly’ => ‘readonly’ );
$fields[‘billing’][‘billing_phone’][‘custom_attributes’] = array( ‘readonly’ => ‘readonly’ );
$fields[‘billing’][‘billing_eu_vat_number’][‘custom_attributes’] = array( ‘readonly’ => ‘readonly’ );return $fields;
}We tried with both billing_eu_vat_number and _billing_eu_vat_number.
With _billing_eu_vat_number it creates a new empty field on the billing section?I also tried setting a higher prio to 1 and 5 but nothing changes either.
Any clue how we can achieve this please?Thanks
May 17, 2023 at 8:10 am #115458Hi Fabio,
Can you please try this:
add_filter( 'woocommerce_checkout_fields' , 'make_fields_readonly', 100 ); function make_fields_readonly( $fields ) { $fields['billing']['billing_company']['custom_attributes'] = array( 'readonly' => 'readonly' ); $fields['billing']['billing_phone']['custom_attributes'] = array( 'readonly' => 'readonly' ); $fields['billing']['billing_eu_vat_number']['custom_attributes'] = array( 'readonly' => 'readonly' ); return $fields; }
Let me know if you still encounter issues.
Omar
- AuthorPosts
- You must be logged in to reply to this topic.