• Resolved Pieter Sand

    (@beachholiday)


    Dear Oscar,

    We have noticed that this Ajax call is quite slow:
    /?wc-ajax=wcpbc_get_location

    Typically, the Ajax call takes between 1.2 – 1.8 seconds.

    Is there a way to speed up this Ajax call?

    We are referring to this setting:
    Cache support (Geolocation with cache support)
    Load product prices in the background (Enable this option to refresh the prices via AJAX. It’ll run an AJAX request per page)

    We tried the following solution and it works but has one drawback:
    – we include the plugin files (/wp-content/plugins/woocommerce-product-price-based-on-countries/) in a Cookie Banner setting that only activates these files when the cookie banner has been accepted or rejected. In other words, the Ajax call takes place after the initial load of the site.
    – the downside is that the prices shown initially are for the base/home country before the Ajax call switches the prices to the visitor’s country. As the home country prices are lower than the site visitor’s local country prices, it creates a frustration for the visitor of not getting the best prices.

    We look forward to your suggestions.

    Many thanks for your help on this.

    Piet

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Oscar Gare

    (@oscargare)

    Hi @beachholiday

    A workaround is to load the plugin files, which refreshes the prices without delay.

    If the “Load product prices in the background” option does not work for you, you can use the alternative solution, setting the “Default customer option” to “Geolocate (with cache support).”

    Adding your site to Cloudflare and enabling the WordPress object cache (Redis or Memcached) will decrease the time of the AJAX request.

    Thread Starter Pieter Sand

    (@beachholiday)

    Dear Oscar ( @oscargare )

    Many thanks for your reply and suggestions:

    • Load product prices in the background: this option works for us. It works really, really well for our use case and the only downside is that it is slow. This is essentially what my support request is about.
    • Geolocate (with cache support): we are not keen on this solution, as it creates ‘messy’ urls that are counterproductive. Also, it would mean that a different version of the site has to be cached for each currency.
    • Cloudflare: we use Cloudflare and also APO
    • Object Cache: we have Redis active on our site via the Litespeed Cache plugin.

    Hence, I was hoping that you might have further suggestion how the Ajax call “/?wc-ajax=wcpbc_get_location” could be speeded up but I accept, if this is not possible.

    Kind regards,

    Piet

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.