The VAT number is only validated on the checkout page by this plugin. It’d be reasonable to validate it on the account details (my-account/edit-account) page for customers, too.
Alternatively, you could make $wc_eu_vat_my_account a global and then the following snippet would implement what I’m advising.
add_action(‘woocommerce_save_account_details’, function ($id) {
global $wc_eu_vat_my_account;
try {
$user = get_userdata($id);
$wc_eu_vat_my_account->validate($_POST[‘vat_number’], $user->billing_country);
update_user_meta($id, ‘vat_number’, $_POST[‘vat_number’]);
} catch (Exception $e) {
wc_add_notice($e->getMessage(), ‘error’);
}
}, 12);
Open
Last updated: April 7, 2022
0 comments
Log in to comment on this feature request.