• atharalikhichi

    (@atharalikhichi)


    Hi,
    Many thanks for this awesome plugin.
    It works great but the only problem I see is its only searching from street addresses but not including unit numbers?
    Example address: 2 / 9 cross street Hove, SA 5048, Australia.
    If you will remove 2 in the start that is the unit number, only then it will display results.
    Any possibility to include the unit numbers as well?
    Many thanks for help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I can confirm this plugin is broken due to the above issue.

    Hey @atharalikhichi after a little more research it appears that the unit number or “subpremise” addresses item returned in the json object is broken / doesn’t work. I have created a workaround see the steps below.

    When the user selects the address from the drop down, you need to get the unit number from that. I’m sure there are more elegant solutions out there, however this works.

    e.g.

    let selected = document.getElementById("billing_address_1").value;
    let getUnit = selected.match(/(.*)\//i)
    let unitNo = (getUnit) ? getUnit[1] : '';
    Cas_billing.method.fillInAddress(unitNo);

    I pass the unit number through to the fillInAddress and then add it to the object, this.unitNumber = unitNo;

    Finally in the appendStreetNumber() I check to see if the unit number exists and then add it to the street number.
    let streetNo = ("" != this.unitNumber) ? this.unitNumber + "/" + this.streetNumber : this.streetNumber;

    • This reply was modified 4 years, 10 months ago by Please Help.
    • This reply was modified 4 years, 10 months ago by Please Help.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Address with Unit Numbers’ is closed to new replies.