Woocommerce cart

Hi there! im a little bit confused on how i can make this happen , as you can see in the image above i have a text "Estimated delivery time" and i would like the time to change based on Geolocation.

The text itself is a custom field created with the ACF plugin.

<p><?php the_field('shipping_time', $product_id ); ?></p>

Is it possible to do this without any plugin or with Woocommerce only? (i found out on another thread about geotargeting pro + +acf) but it costs per api call.

  • You can't store it in text via ACF unless you add a field for every country or location that could ever be queried. By geolocation how specific are you looking at? Also keep in mind that geolocation is unreliable unless you have the users GPS, which they have to grant via JS and privacy settings. If you have their address it can be done via an external API, IP might be able to give you a pseudo-accurate country level detection, but it's unreliable. Please clarify on what you mean by geolocation
    – Tom J Nowell
    Mar 22, 2018 at 15:13
  • Also note that 3rd party plugins are out of scope here, any answer would need to be plugin agnostic, which might mean it's generic PHP. Perhaps you should ask how to do geolocation over on stackoverflow along with what data you have available to do it with?
    – Tom J Nowell
    Mar 22, 2018 at 15:15
  • I was thinking > Spain - Europe - Rest of the world But it seems it isn't that easy , thanks for the clarification
    – Simo
    Mar 22, 2018 at 16:15


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.