• Resolved joe08

    (@joe08)


    Hello,

    I am experiencing duplicate requests by using the plugin (some times 6 API hits per request), pushing the API hits pretty high, and actually incurring charges this month on Google Console.

    E.g. I had 25058 hits to /maps/api/distancematrix/json?mode=car&language=en-GB&units=imperial&origins=REDACTED_ORIGIN_ADDRESS&destinations=%2C+&key=REDACTED_KEY

    The first issue is mode=car, this is not a valid travel mode, fortunately it defaults to mode=driving, so there’s no impact on the request, but needs changing.
    https://developers.google.com/maps/documentation/distance-matrix/intro#travel_modes

    Seconly, the destination parameter in most requests is a prepended comma (%2C), and in the 2 most repeated requests I have, this is actually the only value of that parameter. Could it be possible that you have a retry logic or an if-else statement that repeats the request if no destination address is added?
    https://developers.google.com/maps/documentation/distance-matrix/web-service-best-practices#BuildingURLs

    Can we ensure there is a valid address (not just a space or comma) before pinging off to Google?

    Thanks for the plugin 🙂
    Joe

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Gaylord Focker

    (@webdata)

    Hi,

    There are two hooks that launches on the checkout. One is for the fee calculation and the other one is for the hiding, if the limits are exceeded.

    I am not quite sure why your checkout launches the API connection 6 times, but I think those functions may launch repeatedly if there are several ajax requests on the checkout process.

    Kim

    Thread Starter joe08

    (@joe08)

    Hi Kim,

    Thanks for the reply.

    Regardless of which hooks you use, the two issues stand.

    1. mode=car is incorrect. It should be mode=driving
    2. Can you put in place check to ensure some sort of address is provided before requesting a response from the Google Maps API? The main culprit being a single comma.

    Thank you.

    Plugin Author Gaylord Focker

    (@webdata)

    Sure, please update 🙂

    Kim

    Thread Starter joe08

    (@joe08)

    Thank you! 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Duplicate requests’ is closed to new replies.