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 1 post (of 1 total)
  • Author
    Posts
  • #186006
    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.

    Environment:
    – EU VAT for WooCommerce: 4.6.6
    – WooCommerce: 10.8.1
    – WordPress: 7.0
    – Theme: Shoptimizer 2.9.5
    – PHP: 8.1.34
    – Caching/optimization plugins: WPRocket 3.21.3

    I can see in edit mode the field is overlapping the name row.

    Thanks for looking into this!

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.