Postal Code based location restriction is used to check serviceability under the store for the configured zip code.
Some Countries Like Canada, United Kingdom, Netherlands, Peru Etc have Postcodes in the format of Alphanumeric based on the format as L3P 0A1, L5P 0B2, EN16 1E, etc which might be in the format Area Code followed by location code. I.e. L3P would stand for Area code, and there would be thousands of Locations under that code starting from L3P0A1, LP0A2, L3P0A3, and so on.
It is very difficult to put thousands of codes like this in the back end and validate postal codes. So to simplify the process, we can just configure the serviceable postal codes by putting only area codes (first common Codes) since these are in few countable numbers. For E.g, L3P, L5P, L0A so that the system can validate any input after these codes and enter store and continue shopping
Postal code is configured in admin at location restriction. PostalCode is added in alphanumeric, numeric and both added with % in location restriction field. The same zip code is added on the delivery slot page. For the added zip code delivery slot is available
We can configure this in a very few simple steps as guided below:
Step 1: Configure Pattern-based Postal Code Location Restriction (Store Serviceability)
- Navigate to Stores → Configuration → Elite mCommerce →Location Restriction
- Enable The Module- “Yes”, Restriction types – “Zipcodes”, and Click on“Click here to add locations”.
3. Store admin can Add new users/edit the existing one
- Select the Store View “Main Website Store”, Select Country Canada, State and enter the City
- Enter the zip code in the format – <Common Area code>% . For. E.g. L4P% or L4%.
The System will validate the text input entered after these codes. I.e, it can accept the values L4P0123, or L4PAAA.The below image shows the Postal Code entered is L4% meaning when user inputs any values Like L4P0123, or L4PAAA all the cases will be validated and let the user to continue shopping
3. Save the Configuration and flush cache
Output in App:
- Whenever use opens the app He will be able to view the Screen, where he can enter the relevant post code and check store serviceability
- When User enters a non-serviceable code he gets a following message:
- Whenever user wishes to switch his serviceability location from side menu he can select Check Store Serviceability Option/Change Location and this will take to above screen to enter the post code:
- If User already has products in the cart and wishes to change the serviceable location, the cart will show an alert message to the user as shown below- Your cart items will be cleared if the user wishes to change the location. User can click ok and proceed: