• Hi, I’ve been doing some testing, and it seems that the regions don’t work.

    Namely in woocommerce-geolocation-based-products.php
    for the geolocate_ip function I made this change.

    ====================
    $city_record = $city_reader->city( $ip_address );
    var_dump($city_record);

    $country = sanitize_text_field( strtoupper( $city_record->country->isoCode ) );
    $city = sanitize_text_field( strtoupper( $city_record->city->name ) );
    $region = sanitize_text_field( strtoupper( $city_record->mostSpecificSubdivision->isoCode) );

    echo ‘STATE/PROVINCE’ . $region .'<br/>’;
    echo ‘COUNTRY’ . $country .'<br/>’;
    ====================

    For the USA the $region seems to be working correctly, however, Canada always returns a blank. Does maxmind’s data have canada provinces, does this work for Canada? Is there an alternative?

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

    (@royho)

    I have not encountered any region issues thus far with Canada with MaxMind. Perhaps you have some specific region you want to let me know so I can test?

Viewing 1 replies (of 1 total)
  • The topic ‘Regions issue?’ is closed to new replies.