fix Address Auto-Completion

Job ID: 37231710

Budget: €8 – €30 EUR

Task Description for Freelancer

Problem Statement:
The current implementation of our address validation feature does not accept when customers use an address input format where the house number and its extension are separated by a "-". For instance, customers entering "Espelerweg 5-2" might not receive the desired outcome since the current implementation does not correctly handle this input format.

Objective:
Modify the address validation feature to properly process the house number and its extension, even if they're separated by a "-". The result should be consistent with the Postcode.nl API output.

Specific Tasks:

Modify Address Split Function:

Update the split_address function to handle inputs like "Espelerweg 5-2" correctly.
Ensure the "-" character is treated as a space so that "Espelerweg 5-2" is interpreted as "Espelerweg 5 2".
Testing:

Test the modified function with various address formats to ensure it operates correctly across all scenarios.
Ensure the Postcode.nl API is called correctly with the modified address input and that the results are returned as expected.
Documentation:

Document all changes made in the code to ensure easy understanding of the modifications in the future.
Key Considerations:

Ensure existing functionalities are not broken by these changes. Test all relevant parts of the website after implementing modifications.
Pay attention to security. Ensure the changes do not introduce new vulnerabilities to the system.
Related categories: PHP WooCommerce