Check My PostCode - Documentation

Documentation - Check My PostCode

Installation

  1. Download the extension from your Arosoft Dashboard
  2. Navigate to Plugins -> Add New
  3. Then click Upload Plugin
  4. Now click Choose File and select the .zip
  5. Click Install Now
  6. Click Activate Plugin
  7. Adjust translations or translate to a new language with Loco Translate

Update of new version

  • Download the new version from your Arosoft Dashboard
  • Remove your current installation of Check My PostCode from your Plugins tab at the WordPress dashboard.
  • Install the new version as above.

Changelog

Get information on the latest and previous releases from the changelog.

Shortcode [checkmypostcode]

Insert the PostCode Checker at any page with a shortcode,
Use the shortcode [checkmypostcode]

The shortcode arguments are:

position center (default), left, right – (optional)
border true (default), false – (optional)

current_cart – false (default), true, – (optional)

 Use the shortcode with argument [checkmypostcode current_cart=”true”] to make the postcode validation with regards to the actual cart contents.

This could be useful if the post code checker is placed on the checkout page or on another page where the cart already is filled. 

Learn about WooCommerce Shipping Zones

If you are a beginner working with WooCommerce Shipping Zones, it is recommended to first read through the documentation.

Be sure that you are aware of how the shipping zones work, and especially that only shipping methods from the first matched zone are being included at checkout.

Shipping zones match customer address from top to bottom — the first to match the customer address is always used. If no custom zones match, then Locations not covered by your other zones is used.

Add Shipping Cost Suffix

When a user selects an delivery address from the address form, it will be validated and the user will get recieve a notice if delivery is possible or not.

If using this option, the notice will also contain the shipping cost.

Geolocate user position

There is an ability to let users geolocation their current position and interpret it to a postcode.

By clicking the crosshair sign, the user agent position will be geolocated.

The maximum accepted accuracy of the geolocation request can be adjusted.

Before it is possible to start validating delivery addresses, you have to get your Google Maps API Key.

To get started with Google Maps Platform you will need a google billing account. Read this Get Started guide.

Be sure to include the Geocoding API.

Format Validation

Postcode validation

It is possible to validate that a given postcode matches the country´s postcode format. The validation uses the WooCommerce postcode format validator ( is_postcode() ) which is not comprehensive but can be adjusted with the filter “woocommerce_validate_postcode”.

In the example below we check that postcodes in Sweden (SE) are at least 5 characters long. If not, we return false.

				
					add_filter('woocommerce_validate_postcode', function ($valid, $postcode, $country) {


    $postcode_trimmed = trim($postcode);
    $length = strlen($postcode_trimmed);
    if($country == 'SE' && $length < 5) {
        $valid = false;
    } 
    return $valid;
    
}, 999, 3);
				
			

Advanced Settings - Post Code precision level​

If using the plugin Shipping Zones by Drawing, you can use this option to treat a postcode as a precise location. This can be useful in countries where street addresses are delegated to a specific postal code.