Field position doesn’t show correct in address

Forums › WooCommerce EU & UK VAT Numbers Validation – Support Forum › Field position doesn’t show correct in address

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #186007
    Dennis van Rossum
    Participant

    Subject: Block checkout – VAT field overlaps address fields after using the alg_wc_eu_vat_field_position_block_checkout filter

    Hi,

    I’m using EU VAT for WooCommerce on the block-based (React) checkout and I’ve hit a positioning bug with the new alg_wc_eu_vat_field_position_block_checkout filter.

    What I’m trying to do:
    Move the VAT field out of the Contact section and into the shipping/billing address section. I added this filter:

    add_filter( ‘alg_wc_eu_vat_field_position_block_checkout’, function ( $position ) {
    return ‘address’;
    } );

    What works:
    While the address block is in its collapsed/summary state, the VAT field correctly appears directly below the address summary card.

    The bug:
    As soon as the customer clicks “Edit” on the shipping address, the address form remounts and the VAT field is positioned incorrectly — it overlaps the First name / Last name row instead of sitting with the other address fields. After that the field is effectively unusable.

    Root cause I can see in the DOM:
    The filter does not re-register the field to the WooCommerce address location. The input keeps its original contact id contact-alg_eu_vat-billing_eu_vat_number and receives the attribute data-alg-vat-moved="yes". So the field remains a contact-location field and is moved into wc-block-components-address-card-wrapper via JavaScript. When React re-renders the address form on the edit toggle, the moved node ends up overlapping the wc-block-components-address-form fields (it lands on top of the name row).

    Steps to reproduce:
    1. Block-based checkout active.
    2. VAT field set to show (company filled + EU country outside the base country).
    3. Add the filter above, returning ‘address’.
    4. Fill the shipping address so it collapses to the summary card — the VAT field shows correctly below it.
    5. Click “Edit” on the shipping address.
    6. The VAT field now overlaps the First/Last name fields.

    Expected behavior:
    The VAT field should render as a proper field inside the address form in both the summary and edit states, without overlapping core fields — ideally by registering it as an actual address-location additional checkout field via woocommerce_register_additional_checkout_field(), rather than moving the existing contact node with JS.

    Thanks for looking into this!

    #186132
    Hindi
    Participant

    Hi Dennis,

    Thank you for your detailed report and for providing the reproduction steps and technical analysis.

    We have received your request and will review it with our development team to investigate the issue further. We’ll get back to you with any updates as soon as we have more information.

    Thank you for your patience.

    #186244
    Birendra
    Moderator

    Hi Dennis,

    In WooCommerce Block checkout, there is a limitation in how custom fields are handled. If we register the VAT field directly in the address section, it will appear in both shipping and billing sections. Because of this, we register the VAT field in the Contact section and then move it using JavaScript.

    From what I understand, you want to place the VAT field after the Shipping Address block. You can adjust its position using a CSS selector like this:

    add_filter( ‘alg_wc_eu_vat_field_position_block_checkout’, function () {
    return ‘.wc-block-components-address-address-wrapper’;
    } );

    Or place it after a specific field, for example Shipping Company:

    add_filter( ‘alg_wc_eu_vat_field_position_block_checkout’, function () {
    return ‘#shipping-company’;
    } );

    The filter accepts a CSS selector, so you can pass any valid ID (#element-id) or class (.element-class) where you would like the EU VAT field to be inserted.

    Screenshot showing VAT field after Shipping Company: https://prnt.sc/JA5IbSInaSTD

    Could you please try this and let us know if this works for you? If you have any questions or need further help, just let us know.

    Thank you!

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