• Resolved gjokogrkov

    (@gjokogrkov)


    I recently changed hosting for my website. Before that I had no issues using this plugin. MaxMind was configured, “Default Customer Location” was set to “Geolocate” and “Load product prices in background” was set to true. I have 5 pricing zones with 5 currencies configured. Everything was working perfectly. After the migration of the site, the website now is not showing the correct prices and currencies for my customers based on their location. Sometimes it does, and sometimes it doesn’t. I purged cached several times, but to no effect. I even generated new MaxMind licence key, but the issue is still present. I am on Liquid Web hosting now (Nexcess) and using Cloudflare CDN. I have Hotjar installed on my site and I can see clearly that the prices and currencies shown are not the correct ones.

    The page I need help with: [log in to see the link]

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

    (@oscargare)

    Hi,
    Could you share a screenshot of the “Geolocation debug info” section of the WooCommerce System Report (WooCommerce > Status)?

    Thread Starter gjokogrkov

    (@gjokogrkov)

    Hi,

    Here is a link to the screenshot

    https://snipboard.io/tNSXYc.jpg

    Thread Starter gjokogrkov

    (@gjokogrkov)

    Hi again.
    I just had a customer from Canada that were shown prices in GBP (British Pounds). She proceeded to checkout and after entering billing details the prices on the order summary at checkout changed to CAD (Canadian Dollars). She placed the order and I received an order in GBP even though the prices at checkout just before order placement were shown in CAD.
    I have “price based on” setting set to customer billing country. This is really weird. Really need help ASAP. Thanks in advance.

    Plugin Author Oscar Gare

    (@oscargare)

    Hi,

    The problem is WooCommerce get first the country from the GEOIP_COUNTRY_CODE header, and, in your case, this header contains an incorrect value (Bulgaria). Please check it in the geolocation section of the WooCommerce system status.

    You can solve the problem by the following code snippet:

    add_filter( 'woocommerce_geolocate_ip', 'lazypetstore_cf_country' );
    function lazypetstore_cf_country( $country ) {
        return ! empty( $_SERVER['HTTP_CF_IPCOUNTRY'] ) ? $_SERVER['HTTP_CF_IPCOUNTRY'] : $country;
    }

    You can follow the tutorial of wpbeginner to add the code snippet:

    How to Easily Add Custom Code in WordPress (without Breaking Your Site)

    Clear the cache of your cache plugin after adding the code snippet.

    Thread Starter gjokogrkov

    (@gjokogrkov)

    Hi Oscar,

    Thanks for your reply and for the code snippet.
    I added the snippet and it seems to be working fine for now. The prices and currencies are displayed correctly.
    Can you tell me what causes the incorrect value of GEOIP_COUNTRY_CODE ?
    Is it a hosting or caching related issue? Can that be resolved without adding a code snippet?
    Thanks again for your help.

    Plugin Author Oscar Gare

    (@oscargare)

    I can’t solve that question.
    Contact hosting support.

    Thread Starter gjokogrkov

    (@gjokogrkov)

    Okay, no worries. Thanks again.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Geolocation not working after hosting change’ is closed to new replies.