• Resolved scaballe

    (@scaballe)


    I run the woocommerce plugin EU VAT Assistant it works nicely, but I’m interested to change the VAT field to required based on country, I put this code in functions.php but not works.

    add_filter(‘woocommerce_billing_fields’, ‘woocommece_vat_checkout_required’, 10, 2);

    function woocommece_VAT_checkout_required($fields, $country) {
    if($country==’ES’) {
    if (isset($fields[‘vat_number’]))
    {
    $fields[‘vat_number’][‘required’]=true;
    }
    }
    return $fields; }

    Any help is appreciated

Viewing 1 replies (of 1 total)
  • Thread Starter scaballe

    (@scaballe)

    Hi,

    I found the solution in the forum archives:

    add_filter(‘wc_aelia_euva_order_is_eu_vat_number_required’, function($is_vat_number_required, $country)
    { if($country==’ES’) {
    $is_vat_number_required = true;
    }
    return $is_vat_number_required; }, 10, 2);

    regards
    Salvador

Viewing 1 replies (of 1 total)
  • The topic ‘VAT required based on country’ is closed to new replies.