Magento 2 Restrict Zip Codes

Magento 2 Restrict Zip Codes enables users to check delivery availability based on zip codes and helps store owners to restrict orders for the invalid zip codes.

 

Table of Content

  1. Extension Installation
  2. Configuration
  3. Sample CSV with Zip Codes
  4. Restrict Zip Codes in Frontend

 

  1. Extension Installation
  • Extract the zip folder and upload our extension to the root of your Magento 2 directory via FTP.
  • Login to your SSH and run below commands step by step:
    • php bin/magento setup:upgrade
    • For Magento version 2.0.x to 2.1.x - php bin/magento setup:static-content:deploy
    • For Magento version 2.2.x & above - php bin/magento setup:static-content:deploy–f
    • php bin/magento cache:flush
  • That's it.

 

  1. Configuration
    For configuring the extension, login to Magento 2, move to Stores > Configuration > Restrict Zip Codes where you can find various settings to enable the extension.
  • Restrict Zip Codes: Enable the restrict zip codes extension from here.
  • Show Estimated Delivery Time: Set YES to show the estimated delivery time with the order availability in the frontend.  Make sure you have added the estimated delivery days in the CSV you upload.
  • Zip Code Checker Message: Enter zip code checker message to show on the product page.
  • Delivery Availability Message: Enter the message to be displayed on delivery availability.
  • Delivery Unavailability Message: Enter the message to be displayed on delivery unavailability.
  • Delete Existing Zip Codes: If you are using the extension for the first time, this setting has no concern. But for existing extension users, select YES or No to delete the already added zip codes. Save Configuration immediately after setting this option to get the effect of it in CSV you are going to upload.
  • Export Existing Zip Codes: Click to export the already added zip codes is required prior to deleting.
  • Import Zip Codes CSV: Upload the CSV with allowed zip codes and estimated delivery time.


 

  1. Sample CSV with Zip Codes
    The extension facilitates to allow customers to place orders only for the allowed zip codes (locations). Admin can upload the CSV with the allowed zip codes along with the estimated delivery time.


 

  1. Restrict Zip Codes in Frontend
  • Zip Codes Checker on Product Page
    On the product page, zip code checker label is shown along with the zip code input box and the “Check” button. Users can enter their zip code and click the button to check the delivery availability for their locations.


  

 

  • Delivery Unavailability Message
    After adding the zip code and checking the delivery availability, users can see delivery unavailability message if their zip codes are invalid.


  

  • Delivery Availability Message along with the Estimated Delivery Time
    After adding the zip code and checking the delivery availability, users can see delivery availability message if their zip codes are valid. They can also see estimated delivery time if added in the zip codes CSV.


  

  • Zip Code Restriction on Checkout Page
    If a user tries to checkout without checking for product availability and enters a restricted location zip code, a popup with a message as shown below is displayed to not allow the user to proceed for placing the order.