Support » Plugin: EU VAT for WooCommerce » Move VAT position

Viewing 6 replies - 1 through 6 (of 6 total)
  • Has anyone figured this out?

    Hi @chefpanda123,

    Sorry for the late reply. You can change the position of the “EU VAT” field (with “Priority (i.e. position)” option), however, unfortunately, as “password” field is located outside of the billing details section, currently “EU VAT” field can’t be moved there. I will have to look into it more to find a solution. Will get back to you as soon as possible.

    thanks looking forward to hearing from you

    Hi @chefpanda123,

    I was thinking about moving the field to the position after the “Password” field and I think the best solution would be to use JavaScript. I could move it there by using WooCommerce hooks, however, then field’s name would change from billing_eu_vat_number to account_eu_vat_number, which is not good.

    What you need to do is to add just a couple of lines of custom JavaScript code. I would suggest using our small Custom CSS, JS & PHP plugin for that, however, you can also use any other custom JS tool. So if you install the plugin, you need to go to “Tools > Custom CSS, JS & PHP” in your admin dashboard and locate “JS: front-end” option in “JavaScript Options” section. I would also suggest setting position to “Load in footer”. Now there you need to add this code:

    
    jQuery( document ).ready( function() {
        if ( jQuery( '#account_password_field' ).length ) {
            jQuery( '#billing_eu_vat_number_field' ).detach().insertAfter( jQuery( '#account_password_field' ) );
        }
    } );
    

    this will move the field right after the password field, so your customers will have to check “Create an account?” checkbox to make this field visible. If you wish EU VAT field to be always visible (i.e. no matter if “Create an account?” checkbox is checked or not), you can move the field outside of password’s “account” section. To do that you need to add this JavaScript code instead:

    
    jQuery( document ).ready( function() {
        if ( jQuery( 'div.woocommerce-account-fields' ).length ) {
             jQuery( '#billing_eu_vat_number_field' ).detach().insertAfter( jQuery( 'div.woocommerce-account-fields' ) );
        }
    } );
    

    As for logged users (i.e. those who don’t have “Password” field at all), you can just move it to the bottom of the billing section with the plugin’s “Priority (i.e. position)” option.

    Hope that helps and please let me know if that’s good enough or if you have any questions.

    P.S. If it was what you needed and you like the plugin, please consider leaving me a rating.

    Hi,

    Thank you. Can I paste this code on our functions.php file on our child theme?

    Best regards,
    Ricardo Franco

    Plugin Author Omar AlDabbas

    (@omardabbas)

    Hi @chefpanda123,

    This code should be used in the javascript file that controls the checkout page in your theme, and it’s different from a theme to another.

    What theme you’re using (and possible a link to your store) so I can check?

    Omar

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.