• emersonoliveiraareal

    (@emersonoliveiraareal)


    Hi,

    I’m having an issue retrieving pickup points on my client’s site.

    When a customer registers using Google, their cart has blank address fields. Later, when the customer fills in their address, the getCustomerLocation function is triggered as expected, but it still returns empty values because the condition uses && instead of ||.

    To fix this, I changed the condition to use ||, so the values are retrieved correctly:

    let street1 = $('#shipping_address_1').val() || $('#billing_address_1').val();
    let street2 = $('#shipping_address_2').val() || $('#billing_address_2').val();
    let city = $('#shipping_city').val() || $('#billing_city').val();

    I suggest moving the get_delivery_location AJAX call into a separate function (e.g., getDeliveryLocation) so it can be reused and triggered at different points in the system, such as within changeShipping. This adjustment would ensure pickup points are properly loaded not only on page load, but also when selecting Cargo Shipping. Would it be possible to implement this change?

    Thanks

Viewing 1 replies (of 1 total)
  • Plugin Author cargord

    (@cargord)

    hi @emersonoliveiraareal

    Thanks for reaching us out, we checked the code and oyu don’t seem to have relevant code. update your plugin to the latest varsion please.

    1. we don’t use neither && or || we use ?? instead, so if there is no value of shipping address it’s gonna take the billing details.
    2. we do have it as a separate function getCustomerLocation
    3. It does load pickup points when you change shipping method, or click the button, but not just on page load.

    Please make sure you have the most updated plugin.

    • This reply was modified 7 months, 2 weeks ago by cargord.
Viewing 1 replies (of 1 total)

The topic ‘Problem with getCustomerLocation and get_delivery_location’ is closed to new replies.