Resolvedgoogle.maps.places.Autocomplete
Tagged: places.Autocomplete
- This topic has 16 replies, 3 voices, and was last updated 1 year, 2 months ago by
Alex.
- AuthorPosts
- June 16, 2022 at 5:31 am #34057
likewebcl
ParticipantHello, I need to edit the call of the Google Maps autocomplete api, the queries are very high since queries by letters are organically configured and I need to configure queries by user, as indicated here in the Google Maps Platform documentation:
https://developers.google.com/maps/documentation/javascript/places-autocomplete#session_tokens
Could you tell me or help me where to edit or add these code within the theme
June 16, 2022 at 5:41 am #34058likewebcl
ParticipantOr do you recommend using a plugin like? : https://wordpress.org/plugins/scripts-n-styles
June 16, 2022 at 2:46 pm #34061Althemist
KeymasterHi likewebcl,
I’ll ask our lead developer Alex to step in and give you information what and where can be done.
June 16, 2022 at 3:41 pm #34063Alex
KeymasterHi likewebcl,
For the autocompletion we are using the Autocomplete widget with limiting the result to only required fields. The documentation says that when using the widget, it handles the sessions automatically in the background. So the costs are optimized as much as possible.
Look at the first tip in from the link you sent:
Tip: If your app is using the Autocomplete Widget you don’t need to implement sessions, as the widget handles sessions automatically in the background.
Regards,
AlexJune 16, 2022 at 11:50 pm #34066likewebcl
ParticipantThank you Alex for your answer, we are in test mode and only with these queries the number of requests is very high, next week the trial starts and we will closely monitor the number of queries that are shown…
@Alex, taking advantage of your intervention we have two points that we need to solve and hopefully you can help us:1.- Alex, within the development we also need that the address options appear for a specific country/city and not the whole world, in the api maps documentation at this link: https://developers.google.com/maps/documentation/javascript/places-autocomplete#constraining-autocomplete informs about that and how to configure it, in the topic where I can edit this code
2.- we installed a delivery plugin: https://wordpress.org/plugins/local-delivery-drivers-for-woocommerce (pro), but it has a compatibility problem (found), I explain: when products are added to the cart, these they disappear after a few minutes or simply go to checkout, I contacted support for this plugin and after testing they sent this message:
This is the error and I think it comes from the lafka plugin or theme,
please send it to their support for a fix.get_cart was called incorrectly, Get cart should not be called before the wp_loaded action
[15-Jun-2022 04:14:01 UTC] get_cart was called incorrectly. Adquirir carrito no debería ser llamado antes de la acción wp_loaded Backtrace: require(‘wp-blog-header.php’), require_once(‘wp-load.php’), require_once(‘wp-config.php’), require_once(‘wp-settings.php’), do_action(‘init’), WP_Hook->do_action, WP_Hook->apply_filters, WooCommerce->init, do_action(‘woocommerce_init’), WP_Hook->do_action, WP_Hook->apply_filters, LDDFW_Admin->lddfw_shipping_settings__premium_only, WooCommerce->__get, WooCommerce->shipping, WC_Shipping::instance, WC_Shipping->__construct, WC_Shipping->init, do_action(‘woocommerce_shipping_init’), WP_Hook->do_action, WP_Hook->apply_filters, Lafka_Shipping_Areas::clear_wc_shipping_rates_cache, WC_Cart->get_shipping_packages, WC_Cart->get_items_needing_shipping, WC_Cart->get_cart, wc_doing_it_wrong. This message was added in version 2.3.
Thank you very much Alex and excellent work with the lafka theme!!
June 17, 2022 at 7:31 am #34075likewebcl
ParticipantHi again
Another detail that is important and we have found, when we are on the checkout page, finishing the order, in the address item it is possible to edit/change the address and the previously registered address in the pop-up window is updated by this new address… the problem is that this new address is not within the shipping area, in the same way the payment can be made, the correct thing is that these orders should not be accepted (the validation is not encoded as in the pop-up window).
The other option and it would be better: the address field in the checkout is blocked and another address cannot be entered, only the one registered in the pop-up window can be used..
I hope you feel that the idea is to optimize and enhance the work you have done with this theme, since solving these details and as I have mentioned before will be one of the best themes… thank you very much
June 20, 2022 at 4:43 pm #34101Alex
KeymasterHi likewebcl,
Please allow us couple of more days to look up / investigate the issues.
Regards,
AlexJune 21, 2022 at 1:35 am #34107likewebcl
ParticipantOK thank you very much
June 21, 2022 at 4:21 pm #34136Alex
KeymasterHi likewebcl,
We went through your questions. Here is our thoughts:
1. We don’t provide an option to set boundaries for the Autocomplete widget, neither there is a hook or something to inject a code. The only way I can think of is to edit the js file manually and keep track of it after each update of the theme and plugin. The file you need to edit is: lafka-branch-locations-front.min.js You can edit the minified version, search for “google.maps.places.Autocomplete” and just add the boundaries options according to the documentation.
We know it is not the perfect solution, but there is no a better way currently. We will discuss with the team and may add it as an option in future updates.2. We’ve went through the code and we can’t find a place where we are calling get_cart before wp_loaded. Could you please check if the issue appear with the lafka-plugin disabled or with another theme or both. If it appears only with Lafka, then we will need a copy of the plugin you are using, as it is a pro version.
3. About the issue you describe for the user address validation in the checkout page. Actually all checks that are done in the popup are executed also on the checkout page if the user changes the address. So shipping should also be affected. Can you send us an url to the site. And temporary admin credentials, so we can check.
Regards,
AlexJune 22, 2022 at 3:08 am #34143likewebcl
ParticipantThis reply has been marked as private.June 24, 2022 at 5:11 pm #34206Alex
KeymasterHi likewebcl,
Thank you for the details. Please allow few more days to investigate.
Regards,
AlexJune 24, 2022 at 10:05 pm #34209June 28, 2022 at 2:38 pm #34228Alex
KeymasterThis reply has been marked as private.June 28, 2022 at 3:01 pm #34229Alex
KeymasterHi likewebcl,
I think I understand what do you mean about the checkout page and the address. I couldn’t check all your settings as the account you give me doesn’t have the admin privileges.
But here is how we’ve designed this:
1. You are drawing the areas where all your stores will deliver and name them accordingly.
2. Create shipping methods for each area and select them to be limited by this area. (This way the clients will not be allowed to order outside the area when they change the address at checkout)
3. Create branches for each area.We don’t think it is good idea to limit the clients to change their addresses on checkout, as this is a common functionality.
Hope you see my point.
Regards,
AlexJune 28, 2022 at 3:11 pm #34230Alex
KeymasterHi likewebcl,
Regarding the issue with the plugin “Local Delivery Drivers for WooCommerce” , we’ve tested on our site with the free version and there were no issues.
Could you please give us the exact steps on how to reproduce the issue? Also what are the exact settings in the plugin.
I couldn’t download it from the link you’ve sent.Regards,
Alex - AuthorPosts
You must be logged in and have valid license to reply to this topic.