WordPress.org

Forums

WP Store Locator
[resolved] Countries That Don't Use Zip Codes (6 posts)

  1. myhreco
    Member
    Posted 1 year ago #

    The system doesn't allow me to save locations in countries that don't use zip codes, such as China. Can zip code field be set to be not required? Thanks for any info!

    https://wordpress.org/plugins/wp-store-locator/

  2. Tijmen Smit
    Member
    Plugin Author

    Posted 1 year ago #

    If you open the class-admin.php, then search for 'function validate_store_data' and remove this part.

    ( empty( $store_data['zip'] ) ) ||

    I'm not sure if that won't cause problem when the address you provided is sent to the Google Maps API for the geocoding.

    What is the exact address you are trying to add, then I can try it out.

  3. myhreco
    Member
    Posted 1 year ago #

    Thanks for the info. Removing the code above does allow me to save a new store into the system, but the system still prompts me for a zip code as required when clicking on the "Preview location on the map" button. An example address that doesn't use zip codes is:

    LG/F & G/F, 11 Stanley Street, Central, Hong Kong, China

    Entering the above address into a Google maps search comes up with the correct location for that store.

    Also, a side thing I just noticed... since updating the plugin to the latest version yesterday, the "Preview location on the map" button has stopped working - doesn't generate anything on the map when clicking the button, even when using a standard US address with zip code and all fields completed. It was working okay before I updated.

  4. Tijmen Smit
    Member
    Plugin Author

    Posted 1 year ago #

    If you open the /admin/js/wpsl-admin.js and search for 'validatePreviewFields', then look for this line of code, and just remove it.

    if ( !zip ) {
      $( "#wpsl-store-zip" ).addClass( "wpsl-error" );
         error = true;
    }

    Do you happen to have Firefox 30 and are using the webdev toolbar add-on? If so, then go to disable -> disable javascript -> and uncheck the 'disable strict javascript warnings'. This is a bug in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=998908 which they will fix in the next release. This will break Google Maps.

  5. Tijmen Smit
    Member
    Plugin Author

    Posted 1 year ago #

    And I will remove the zip code requirement in the next version :)

  6. myhreco
    Member
    Posted 1 year ago #

    Thanks for all your help! Even after removing that code from the wpsl-admin.js file, it's still requiring me to enter a zip code for map generation, but not a big deal - found out that if I just put a blank space into the zip code field, it will generate the map, so that works for now.

    And thanks for the tip on Firefox - even after changing the webdev toolbar settings, Firefox is still being buggy, so I'm just using a different browser and it's working fine on the other one.

    By the way... Excellent plugin!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Store Locator
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic