• Resolved Magle

    (@magle)


    When visiting the checkout page on my Woocommerce shop, the EU VAT field is automatically shown as if an invalid value was entered (with red borders), before entering anything into the field.

    This is a problem for customers without a EU VAT number since it implies it needs to be filled out even though it’s optional.

    I have tried to find the cause of this but have given up (if there f.ex. was a setting I have missed). Any help would be appreciated, thanks.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • loxlie

    (@loxlie)

    It’s these lines, in the Javascript file includes/js/alg-wc-eu-vat.js, line 160.

    var vat_number_to_check = vat_input.val();
    if ( undefined != vat_number_to_check ) {

    A blank value is “”, not “undefined”. As a quick fix, I added this line:

    var vat_number_to_check = vat_input.val();
    if(""===vat_number_to_check.trim()) vat_number_to_check = undefined; // Fix
    if ( undefined != vat_number_to_check ) {

    It should now ignore any blank values (or if there’s just spaces entered).

    Thread Starter Magle

    (@magle)

    Thanks a lot, loxlie! It works. The borders of the field are now green from start, but that’s much better than the red “warning”. Really appreciate this fix, it was driving me insane not being able to figure out how to get rid of the red border ??

    Plugin Author Omar AlDabbas

    (@omardabbas)

    @loxlie Thanks a lot for the fix here, will make it included in the next update so you don’t lose it each time plugin is updated.

    Omar

    Plugin Author Omar AlDabbas

    (@omardabbas)

    Hi @magle & @loxlie

    Please update to latest version, the fix is part of the code now, thanks again.

    Omar

    Thread Starter Magle

    (@magle)

    Thanks, Omar! The updated version works perfectly. Appreciate the fix.

    Plugin Author Omar AlDabbas

    (@omardabbas)

    Awesome @magle, glad to hear this.

    If you’re enjoying the plugin, it would be great if you can leave us a review.

    Omar

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘EU VAT number field shown as “invalid” (red borders) before entering any value’ is closed to new replies.