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. Manage Allowed Zip Codes
  5. Restrict Zip Codes in Frontend

 

  1. Extension Installation
    • For Magento Marketplace Customers
      • Create a folder structure in Magento root as app/code/Meetanshi/RestrictZip
      • Download and extract the zip folder and upload our extension files to the app/code/Meetanshi/RestrictZip 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

 

    • For Meetanshi Customers
      • 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

 

  1. Configuration
    For configuring the extension, login to Magento 2, move to Stores à Configuration à Meetanshi à 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.
  • Import Zip Codes CSVUpload the CSV with allowed zip codes and estimated delivery time.
  • Display Zip Code Checker As: Select one of the options on how you want to show the zip code checker on the product page.
    • Popup: Design and open up a popup for users to check the delivery availability by entering zip code.
    • Inline Form: Show delivery availability checker along with the product information

 

  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. Manage Allowed Zip Codes
    The extension facilitates to manage allowed zip codes imported through CSV and also, the zip codes added manually. All the already imported and saved zip codes get enlisted here.

 

  • Add New Zip Code
    On click of the “Add New Zip Code” button from the Manage Allowed Zip Codes grid, the admin can add new zip codes manually. Enter the allowed zip code details like zip code number, estimated delivery time and store ID for which the zip code is allowed. Save the configuration to allow the zip code for the delivery.

 

 

  1. Restrict Zip Codes in Frontend
    On the product page, zip code checker label is shown.
  • Inline Form Type Zip Codes Checker
    The inline form type zip code checker is displayed below the product price and stock availability. It has 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 for the inline form type zip code checker, users can see delivery unavailability message if their zip codes are invalid.

 

  • Popup Type Zip Code Checker with Delivery Availability Message
    If you have selected “Popup” type from the Display Zip Code Checker, on click of the zip code checker label from the product page, the zip code checker popup is opened. Add the zip code and click to check the delivery availability. Users can see delivery availability message in popup itself if the zip code is valid. Estimated delivery time is also displayed if added through the zip codes CSV or manually while adding the zip code from the grid.

 

  • 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.