Free open-source Magento 2 modules — professional installation & support available
Magendoo
magendoo-shipping-restrictions
Digital

Shipping Restrictions for Magento 2

SKU: magendoo-shipping-restrictions

Free
Quantity
  • Instant access after order confirmation
  • Open source — MIT licensed
  • Free updates included
  • Professional support available

Need help?

Contact our support team for product questions.

Instant Download

After payment

MIT Licensed

Use in any project

Secure Payment

SSL encrypted

Support Included

With every purchase

Shipping Restrictions for Magento 2

Control exactly which shipping carriers appear at checkout depending on the customer's delivery ZIP code. Ideal for local delivery zones, regional logistics contracts, or country-specific carrier availability. Uses a whitelist model — if a carrier is not explicitly allowed for a ZIP code, it is hidden.

How It Works

  1. Customer enters a shipping address at checkout
  2. A plugin intercepts each carrier's collectRates() call
  3. The module queries the restrictions table for the (ZIP code + carrier code) pair
  4. If a record exists, the carrier is allowed; if not, it is blocked
  5. The customer only sees the carriers you have explicitly permitted for their area

Whitelist vs. Blacklist

The module uses a whitelist approach — zero config means all carriers are blocked for a given ZIP. You explicitly define which carriers to allow per zone. This prevents accidental exposure of carriers to regions you don't service.

Supported Carriers (out of the box)

  • Flat Rate (flatrate)
  • Free Shipping (freeshipping)
  • Table Rate (tablerate)
  • Any custom carrier via plugin configuration

Admin Interface

Manage restrictions at System → Shipping Restrictions:

  • Add / edit / delete restriction rules
  • Search and filter by ZIP code or carrier code
  • Bulk import via CSV for large zone configurations

Performance

  • Dedicated table magendoo_shippingrestrictions_shippingrestriction
  • Composite index on (zip_code, carrier_code) — queries complete in < 1 ms
  • Separate indexes on zip_code and carrier_code for partial lookups
  • Dedicated log file at var/log/shipping_restrictions.log for debugging

Compatibility

  • Standard Magento checkout
  • GraphQL checkout (compatible with headless and PWA storefronts)
  • Multi-store / multi-website setups

Installation

composer require magendoo/module-shippingrestrictions
bin/magento module:enable Magendoo_ShippingRestrictions
bin/magento setup:upgrade && bin/magento cache:flush

Requirements

  • Magento 2.4.x
  • PHP 8.1 or higher

License: MIT  |  View on GitHub

Compatibility & Installation

  • Magento: 2.4.x
  • License: MIT
  • PHP: see the GitHub repository for the current compatibility matrix

The package is not on Packagist; install it from the GitHub repository:

composer config repositories.magendoo-shipping-restrictions vcs \
  https://github.com/magendooro/magento2-shipping-restrictions.git
composer require magendoo/module-shippingrestrictions

Key Features

  • Whitelist model — only explicitly allowed (ZIP code + carrier) pairs are shown; unconfigured ZIP codes see no methods from managed carriers
  • Works with Flat Rate, Free Shipping, and Table Rate out of the box; custom carriers via plugin configuration
  • Admin grid at System → Shipping Restrictions with add / edit / delete and inline editing
  • Compatible with the standard checkout and GraphQL / headless storefronts
  • Sub-millisecond lookups via a composite (zip_code, carrier_code) database index
  • Service-contract API (ShippingRestrictionRepositoryInterface) for programmatic restriction management
  • Dedicated debug log at var/log/shipping_restrictions.log

Last updated: November 2025 · 7abb3ff

FAQ(5)

Have a question?