View Categories

EU/UK VAT Manager: Developer Hooks and Filters Reference

The EU/UK VAT Manager for WooCommerce exposes filters and one action so you can adjust the VAT field, the validation flow and the exemption logic in code without editing plugin files. All hooks use the alg_wc_eu_vat_ prefix. The VAT number is stored in the order and user meta key _billing_eu_vat_number.

Field filters #

Filter Filtered value Arguments
alg_wc_eu_vat_get_field_id The field id base (default eu_vat_number, prefixed to billing_eu_vat_number) $field_id
alg_wc_eu_vat_get_field_data The full checkout field definition array (label, placeholder, required, class, priority) $field_data
alg_wc_eu_vat_confirmation_bg_yes / alg_wc_eu_vat_confirmation_bg_no The Yes/No button colors for the empty-VAT confirmation notice (green / red) $color

Change the stored field id #

add_filter( 'alg_wc_eu_vat_get_field_id', function ( $field_id ) {
    return 'vat_id'; // stored meta becomes _billing_vat_id
} );

Validation filters #

Filter Filtered value Arguments
alg_wc_eu_vat_validation_response The raw response from the validation service (use it to route validation through another API) $response, $method, $country_code, $vat_number
alg_wc_eu_vat_check_alternative The validation result after the primary and fallback checks $result, $country_code, $vat_number, $billing_company
alg_wc_eu_vat_validation_methods The ordered list of methods to try (soap, curl, file_get_contents) $methods
alg_wc_eu_vat_is_valid_vat_at_checkout Whether the VAT number is treated as valid at checkout $is_vat_valid
alg_wc_eu_vat_vatsense_key The VATSense API key used for UK and non-EU validation $key

Exemption and gateway filters #

Filter Filtered value Arguments
alg_wc_eu_vat_maybe_exclude_vat Whether VAT is excluded (admin-side calculation) $is_exempt
alg_wc_eu_vat_maybe_exclude_vat_on_available_gateway Whether VAT is excluded when filtering available payment gateways $is_exempt

Pro-gated feature filters #

These filters resolve the Pro-only features. In the free version each returns its default (so the feature is off); in Pro the option value is returned.

  • alg_wc_eu_vat_check_ip_location_country – whether the check-country-by-IP feature is active.
  • alg_wc_eu_vat_check_company_name – whether the company-name check is active.
  • alg_wc_eu_vat_show_in_countries – the country list the field is limited to.
  • alg_wc_eu_vat_show_for_user_roles – the user roles the field is limited to.
  • alg_wc_eu_vat_settings – the Pro gate itself: it returns an empty string in Pro and array( 'disabled' => 'disabled' ) in the free version, which is how Pro-only fields are disabled in the admin.

Context filters #

  • alg_wc_eu_vat_is_checkout and alg_wc_eu_vat_is_cart – override the plugin’s cart/checkout detection.
  • alg_wc_eu_vat_get_settings – filter the full settings array ($settings, $current_section, $id, $obj).
  • alg_wc_eu_vat_advertise – the in-admin advertisement text.

Action #

Action Fires when Arguments
alg_wc_eu_vat_exempt_applied After the plugin decides whether to exempt VAT for the current customer $is_vat_exempt
add_action( 'alg_wc_eu_vat_exempt_applied', function ( $is_vat_exempt ) {
    if ( $is_vat_exempt ) {
        // e.g. tag the session, add an order note, log the exemption
    }
} );

Helper functions #

Two functions are handy when reading the VAT number in your own code:

  • wpfactory_wc_eu_vat_get_field_id() – returns billing_eu_vat_number (pass true for the short form eu_vat_number).
  • wpfactory_wc_eu_vat_validate_vat( $country_code, $vat_number, $billing_company ) – validates a number and returns true, false, or null when the service could not be reached.

Shortcode #

The plugin registers one shortcode, [alg_wc_eu_vat_translate], for per-language text. See the Shortcodes guide.

Need help? #

If you are extending EU/UK VAT Manager for WooCommerce and a hook does not behave as expected, contact the team on the support forum with the filter name and a short code sample.