• Resolved SYNC4489

    (@sync4489)


    Hi,

    we have a problem when adding a new address at the checkout page.
    Once a new shipping address is added and the order placed, the VAT number field of the user is cleared.
    The form field name, id, and DB user_meta, are ‘vat_number’.

    If the address is added from the My Account page, it works correctly, the vat_number is correctly kept.
    In the checkout page, if the address is just switched from one to the other, the vat number is correctly kept too.

    We tried to exclude the id ‘vat_number’ in the scripts.js at line 112 (of course in the minified version scripts.min.js) by modifying with:

    $( '.shipping_address input' ).not( $( '#shipping_country', '#vat_number' ) ).each(

    but no luck…

    Any help? Thanks in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Matt Harrison

    (@matt-h-1)

    I can’t think of why this wouldn’t be saving in checkout. The field saving on checkout uses the standard WooCommerce functions so it shouldn’t change that.

    How are you adding the vat_number field to the checkout? If I’m able to reproduce the issue with your field I might be able to see what is going on to cause it to not save.

    Thread Starter SYNC4489

    (@sync4489)

    Hi Matt,

    the vat_number field is added by the “Aelia EU Vat Assistant” plugin.

    This is the full HTML added by the plugin at the checkout page, into the div “woocommerce-billing-fields__field-wrapper”

    <p class="form-row aelia_wc_eu_vat_assistant vat_number update_totals_on_change address-field form-row-wide" id="vat_number_field" data-priority="250">
    <label for="vat_number" class="">EU VAT Number&nbsp;<span class="optional">(optional)</span></label>
    <span class="woocommerce-input-wrapper"><input type="text" class="input-text " name="vat_number" id="vat_number" placeholder="EU VAT Number" value="MT12345678" valid="0" aria-describedby="vat_number-description">
    <span class="description" id="vat_number-description" aria-hidden="true">Enter your EU VAT Number (if any). Country prefix is not required.</span>
    </span></p>

    To be noted that on our website all the billing fields are hidden by a simple CSS visibility:hidden and height:1px, because we do not want customers to be able to change their billing details as they wish. I don’t think this should pose a problem as it’s only a mere CSS and if no address is added by the addressbook plugin, it works flawlessly since months…

    The problem occurs only when a new address is added at checkout page.
    If the addresses are just switched on the dropdown select, the vat_number field is correctly kept.

    Thanks in advance!

    Thread Starter SYNC4489

    (@sync4489)

    Hi,

    did you have the chance to look about the problem?

    Thanks

    Plugin Author Matt Harrison

    (@matt-h-1)

    Hi,

    I tried out the Aelia EU Vat Assistant plugin and it did add the VAT number under the billing fields as you described.

    However, no matter how I tried checking out with a new address it consistently saved it and never touched the VAT number field.

    I’m not sure what you have different that is causing it to not work properly.

    Although you said you are hiding the billing fields and the VAT number shows up under billing and not shipping.

    If from your first post it is actually under shipping so it is clearing out with the shipping fields then your code modification might actually work although you had an error in your javascript in the first snippet. If that does in fact work it would be.

    
    $( '.shipping_address input' ).not( $( '#shipping_country,#vat_number' ) ).each(
    

    Matt

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘VAT Number overwritten’ is closed to new replies.