mage2kishan / module-zipcode-validation
Panth ZipcodeValidation โ validates ZIP/PIN codes at checkout against configurable country-specific ranges. Ships with pre-loaded ranges for India, US, UK, Canada, Australia, and Europe. Includes admin grid for managing ranges, CSV/JSON import-export, and real-time AJAX validation on the storefront.
Package info
github.com/mage2sk/module-zipcode-validation
Type:magento2-module
pkg:composer/mage2kishan/module-zipcode-validation
Requires
- php: ~8.1.0||~8.2.0||~8.3.0||~8.4.0
- mage2kishan/module-core: ^1.0
- magento/framework: ^103.0
- magento/module-backend: ^102.0
- magento/module-checkout: ^100.4
- magento/module-config: ^101.2
- magento/module-customer: ^103.0
- magento/module-directory: ^100.4
- magento/module-store: ^101.1
- magento/module-ui: ^101.2
README
ZIP/PIN Code Validation at Checkout โ Panth Zipcode Validation for Magento 2 | Panth Infotech
ZIP/PIN Code Validation at Checkout โ validate postal codes against configurable country-specific ranges before customers place an order. Ships with pre-loaded ranges for India, US, UK, Canada, Australia, and Europe, a full-featured admin grid, CSV/JSON import-export, and real-time AJAX validation on the storefront.
Panth Zipcode Validation lets merchants restrict checkout to serviceable delivery areas by validating ZIP/PIN codes against configurable country-specific ranges. Out of the box you get pre-loaded range data for India (PIN codes), United States (ZIP codes), United Kingdom (postcodes), Canada, Australia, and major European countries. Admins can extend or override any range through the admin grid, and merchants handling thousands of serviceable pincodes can use CSV/JSON import-export to manage data in bulk. On the storefront, validation runs in real time via AJAX so customers see "out of service area" messages instantly without waiting for full checkout submission.
Whether you're a courier/delivery business limiting to serviceable pincodes in India, a regional retailer restricting shipments to specific US states, or a European merchant validating postcodes per country, Panth Zipcode Validation provides a single configurable engine for all of it.
๐ Need Custom Magento 2 Development?
Get a free quote for your project in 24 hours โ custom modules, Hyva themes, performance optimization, M1โM2 migrations, and Adobe Commerce Cloud.
Visit our website: kishansavaliya.com ย |ย Get a quote: kishansavaliya.com/get-quote
Table of Contents
- Key Features
- Pre-loaded Country Ranges
- Compatibility
- Installation
- Configuration
- Admin Grid
- CSV / JSON Import-Export
- Real-time AJAX Validation
- FAQ
- Support
- About Panth Infotech
- Quick Links
Key Features
ZIP / PIN Code Validation Engine
- Country-specific ranges โ configure valid postal code ranges per country (e.g., 110000-110099 for Delhi, 90001-90210 for Los Angeles)
- Multiple range types โ numeric ranges, alphanumeric patterns (UK, Canada), exact-match lists, and regex patterns
- Pre-loaded country data โ India, US, UK, Canada, Australia, and major European countries ready to go
- Allow-list or block-list mode โ either restrict to serviceable areas or block specific excluded ranges
- Per-store configuration โ different range sets for different store views (useful for multi-country stores)
Admin Grid
- Full-featured UI component grid โ search, filter, sort, bulk actions, pagination
- Inline add/edit/delete โ manage ranges without page reloads
- Status toggles โ enable/disable individual ranges on the fly
- Audit fields โ created-at and updated-at timestamps tracked automatically
- Mass actions โ enable/disable/delete in bulk
CSV / JSON Import-Export
- Bulk import โ upload thousands of pincodes via CSV or JSON in one go
- Bulk export โ download all configured ranges for backup or editing offline
- Validation on import โ duplicate detection, format checks, clear error messages
- Template downloads โ CSV and JSON sample templates provided in admin
Real-time AJAX Validation
- Instant feedback at checkout โ customers see validation errors the moment they type a postcode
- Debounced AJAX requests โ no server flooding while customers type
- Customizable error messages โ configure per-country "We do not deliver to this area" messaging
- Graceful fallback โ if AJAX fails, server-side validation still runs on form submit
- Works on both Hyva and Luma โ via
Panth\Core\Helper\Themedetection
Storefront Behaviour
- Blocks checkout on invalid postcode โ customers cannot proceed to payment if postcode is outside serviceable area
- Custom message per country โ India, US, UK, etc. each get their own rejection message
- Guest and logged-in support โ validation runs for both customer types
- Address book integration โ validates postcodes when customers save new addresses too
Security & Performance
- MEQP compliant โ passes Adobe's Magento Extension Quality Program
- Indexed lookups โ optimized database schema with indexes on country_id and range fields
- Cached country data โ pre-loaded ranges cached per store view for fast AJAX response
- Built on Panth Core โ reuses shared admin foundation, zero duplication
Pre-loaded Country Ranges
The module ships with curated postal code range data for the following countries:
| Country | Format | Coverage |
|---|---|---|
| India | 6-digit PIN codes | All 28 states + 8 union territories |
| United States | 5-digit ZIP codes | All 50 states + DC |
| United Kingdom | Alphanumeric postcodes | England, Scotland, Wales, N. Ireland |
| Canada | Alphanumeric postal codes | All 10 provinces + 3 territories |
| Australia | 4-digit postcodes | All 6 states + 2 territories |
| Germany | 5-digit postleitzahl | Nationwide |
| France | 5-digit code postal | Nationwide |
| Italy | 5-digit CAP | Nationwide |
| Spain | 5-digit cรณdigo postal | Nationwide |
| Netherlands | Alphanumeric postcodes | Nationwide |
You can enable, disable, override, or extend any country dataset from the admin grid.
Compatibility
| Requirement | Versions Supported |
|---|---|
| Magento Open Source | 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8 |
| Adobe Commerce | 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8 |
| Adobe Commerce Cloud | 2.4.4 โ 2.4.8 |
| PHP | 8.1.x, 8.2.x, 8.3.x, 8.4.x |
| MySQL | 8.0+ |
| MariaDB | 10.4+ |
| Hyva Theme | 1.0+ |
| Luma Theme | Native support |
| Required dependency | mage2kishan/module-core (free) |
Installation
Composer Installation (Recommended)
composer require mage2kishan/module-zipcode-validation bin/magento module:enable Panth_Core Panth_ZipcodeValidation bin/magento setup:upgrade bin/magento setup:di:compile bin/magento setup:static-content:deploy -f bin/magento cache:flush
Manual Installation via ZIP
- Download the release ZIP from Packagist or the Adobe Commerce Marketplace
- Extract to
app/code/Panth/ZipcodeValidation/ - Ensure
Panth_Coreis also installed (required dependency) - Run the same commands as above
Verify Installation
bin/magento module:status Panth_ZipcodeValidation
# Expected output: Module is enabled
After installation, navigate to:
Admin โ Panth Infotech โ Zipcode Validation
Admin โ Stores โ Configuration โ Panth Extensions โ Zipcode Validation
Configuration
Settings live under Stores โ Configuration โ Panth Extensions โ Zipcode Validation:
| Setting | Default | Description |
|---|---|---|
| Enable Module | Yes | Master toggle for all zipcode validation |
| Validation Mode | Allow-list | Allow-list (only listed ranges accepted) or Block-list (listed ranges rejected) |
| Enabled Countries | India, US, UK, CA, AU | Which country datasets to activate for the current store |
| Real-time AJAX Validation | Yes | Validate postcodes as the customer types at checkout |
| AJAX Debounce (ms) | 400 | Delay before firing AJAX validation request |
| Error Message | "Sorry, we do not deliver to this area." | Default message shown on invalid postcode |
| Block Checkout on Invalid | Yes | Prevent customers from proceeding if postcode is out of range |
| Validate Address Book | Yes | Also validate postcodes when customers save new addresses |
Admin Grid
Access the admin grid at Panth Infotech โ Zipcode Validation โ Ranges:
- Search by country, range start, range end, or label
- Filter by country, status, or date
- Sort any column ascending/descending
- Inline edit labels and status
- Bulk enable/disable/delete with mass actions
- Full keyboard navigation
- Exports respect current filters (export only what you searched)
CSV / JSON Import-Export
Import
- Go to Panth Infotech โ Zipcode Validation โ Import
- Download the CSV or JSON template
- Fill in your pincode/ZIP ranges
- Upload the file โ the module validates format, detects duplicates, and reports errors per row
CSV format:
country_id,range_start,range_end,label,status IN,110000,110099,Delhi,1 IN,400001,400099,Mumbai,1 US,90001,90210,Los Angeles,1 US,10001,10099,Manhattan,1
JSON format:
[
{"country_id": "IN", "range_start": "110000", "range_end": "110099", "label": "Delhi", "status": 1},
{"country_id": "US", "range_start": "90001", "range_end": "90210", "label": "Los Angeles", "status": 1}
]
Export
Click Export โ CSV or Export โ JSON from the ranges grid. Current grid filters are respected, so you can export only the rows you care about.
Real-time AJAX Validation
When a customer types a postcode in the shipping address form, the storefront JS debounces keystrokes and fires an AJAX request to the validation endpoint (/panth_zipcode/validate/check). The server responds with either:
{"valid": true}โ postcode is in a serviceable range{"valid": false, "message": "Sorry, we do not deliver to this area."}โ postcode is invalid for the selected country
The form shows an inline error under the postcode field and, if Block Checkout on Invalid is enabled, the "Next" / "Place Order" button is disabled until the customer enters a serviceable postcode.
Validation is theme-aware โ on Hyva storefronts the module uses Alpine.js, on Luma it uses Knockout.js, detected via Panth\Core\Helper\Theme.
FAQ
Does this work with default Magento checkout?
Yes. The module hooks into the core checkout shipping-address step on both Luma (Knockout) and Hyva (Alpine). No checkout rewrites required.
Can I validate only for specific countries?
Yes. In configuration, select which countries should be validated. Unlisted countries skip validation entirely (customers from those countries can check out normally).
Can I use allow-list for India and block-list for US simultaneously?
The global mode setting applies to all countries by default. For per-country logic, use allow-list ranges โ any country that has at least one range defined uses allow-list semantics automatically.
Does the module work for B2B / custom checkouts?
Yes, as long as the checkout collects a postcode field in a standard Magento address form. Custom checkout UIs may need minor JS integration.
Can I import 50,000+ pincodes?
Yes. The CSV importer processes rows in chunks. For very large imports (100k+), we recommend running via CLI to avoid admin session timeouts.
Does it slow down checkout?
No. Validation lookups are indexed and cached per country/store view. Typical AJAX response time is under 30ms.
Does it support multi-store?
Yes. Ranges can be scoped to website/store view, so different store views can have different serviceable areas.
Is the source code available?
Yes. The source is on GitHub at github.com/mage2sk/module-zipcode-validation.
Support
| Channel | Contact |
|---|---|
| kishansavaliyakb@gmail.com | |
| Website | kishansavaliya.com |
| +91 84012 70422 | |
| GitHub Issues | github.com/mage2sk/module-zipcode-validation/issues |
| Upwork (Top Rated Plus) | Hire Kishan Savaliya |
| Upwork Agency | Panth Infotech |
Response time: 1-2 business days.
๐ผ Need Custom Magento Development?
About Panth Infotech
Built and maintained by Kishan Savaliya โ kishansavaliya.com โ a Top Rated Plus Magento developer on Upwork with 10+ years of eCommerce experience.
Panth Infotech is a Magento 2 development agency specializing in high-quality, security-focused extensions and themes for both Hyva and Luma storefronts. Our extension suite covers SEO, performance, checkout, product presentation, customer engagement, and store management โ over 34 modules built to MEQP standards and tested across Magento 2.4.4 to 2.4.8.
Browse the full catalog on the Adobe Commerce Marketplace or Packagist.
Quick Links
- ๐ Website: kishansavaliya.com
- ๐ฌ Get a Quote: kishansavaliya.com/get-quote
- ๐จโ๐ป Upwork Profile (Top Rated Plus): upwork.com/freelancers/~016dd1767321100e21
- ๐ข Upwork Agency: upwork.com/agencies/1881421506131960778
- ๐ฆ Packagist: packagist.org/packages/mage2kishan/module-zipcode-validation
- ๐ GitHub: github.com/mage2sk/module-zipcode-validation
- ๐ Adobe Marketplace: commercemarketplace.adobe.com
- ๐ง Email: kishansavaliyakb@gmail.com
- ๐ฑ WhatsApp: +91 84012 70422
Ready to upgrade your Magento 2 checkout?
SEO Keywords: magento 2 zipcode validation, pin code validation, postal code validation, india pincode magento, delivery area validation, magento 2 checkout zipcode, magento 2 serviceable area, magento 2 pincode checker, magento 2 zip code restriction, magento 2 postcode validator, india pincode checkout magento, us zip validation magento, uk postcode checkout, canada postal code magento, australia postcode magento, european postcode validation, magento 2 ajax postcode, real-time zipcode check, magento 2 delivery restriction, courier serviceable pincode, magento 2 shipping restriction by pincode, panth zipcode validation, panth infotech, hire magento developer, top rated plus upwork, kishan savaliya magento, mage2kishan, mage2sk, magento marketplace developer, custom magento development india, magento 2 hyva development, magento 2.4.8 module, php 8.4 magento, magento 2 checkout optimization