Distance based Delivery costs (Magento 2) – Google-Powered Logistics
- Community
- Google Distance Matrix–driven delivery quoting with fallback Haversine routing
- One-hour delivery windows, slot management, and location-aware pricing
- Geo-logging for driver run grouping, proof-of-delivery, and analytics
- Seamless integration with Store Locator, Store Pickup, and Fulfillment PWAs
The Problem
- ✖ Flat-rate shipping does not reflect real delivery distance or costs
- ✖ Manual delivery zone management becomes difficult as orders grow
- ✖ Stores lose money on long-distance deliveries or overcharge nearby customers
- ✖ Customers expect accurate delivery fees and service availability at checkout
The Solution
Toweringmedia Distance Delivery uses Google-powered distance calculations to charge accurate delivery fees, validate service areas, and automate smarter Magento 2 logistics.
How It works
See It In Action
Rate Calculation Engine
- Primary routing via Google Directions API (driving distance/time) with Haversine fallback when APIs are rate-limited.
- Supports negotiated rates, handling fees, and dynamic surcharges by distance band or geo-zone.
- Session-based caching and quota safeties prevent overages on high-traffic checkouts.
- Picks the optimal fulfillment location per order using Store Locator data and optional geographic restrictions.
- Handles “single delivery only” items, multi-stop routes, and store-specific blackout windows.
Delivery Slot & Schedule Management
- Generates one-hour delivery windows based on each location’s delivery hours and blackout dates.
- Enforces lead-time automatically (e.g., 1-day vs. 2-day products) by reading tm_lead_time_days.
- Provides REST endpoints for fetching available slots and for rescheduling (used by admin modal + kitchen PWA).
Driver & Fulfillment Integration
- Logs lat/lng, distance, duration, and raw API payloads into toweringmedia_delivery_quote_log.
- The Run Grouping service clusters orders by proximity/time so drivers see curated “runs” in the PWA.
- Supports auto-cancellation sync (order canceled → driver tasks removed) and proof-of-delivery uploads.
- Delivery tasks appear alongside pickup tasks on the Fulfillment Board with local window labels and solo-delivery badges.
- Kitchen PWA can reschedule windows on the fly, and driver PWA consumes the same API for run routing.
Security & Observability
- Secure Google API key storage with sandbox/live toggles (shared with Store Locator).
- Event observers attach quote logs to orders, ensuring full audit trail.
- Built-in logging for API retries, quota warnings, and distance anomalies.
Technical Specs
- Magento 2.4.x, PHP 8.2+, requires toweringmedia/base and toweringmedia/module-store-locator
- Composer package: toweringmedia/module-distance-delivery
- Declarative schema introduces toweringmedia_delivery_quote_log
- Includes observers (order-place, cancellation), plugins (ShippingInformation), and DI-configured services for DistanceCalculator, DeliveryScheduleManagement, RunGroupingService
- Ships with REST endpoints consumed by PWAs (/driverportal/fulfillment/*, /runs/*)
Ideal For
- Retailers running their own local courier fleet with strict delivery windows
- Bakeries/caterers scheduling premium same-day deliveries
- Enterprises replacing third-party shipping calculators with a branded experience
- Google Distance Matrix–driven delivery quoting with fallback Haversine routing
- One-hour delivery windows, slot management, and location-aware pricing
- Geo-logging for driver run grouping, proof-of-delivery, and analytics
- Seamless integration with Store Locator, Store Pickup, and Fulfillment PWAs
📘 Documentation
Get started quickly with our detailed user guide. The documentation covers everything from installation to advanced distance-based delivery configuration and Google Maps integration.
- Step-by-step installation instructions
- Configure Google Maps API and store origin address
- Set distance pricing rules and delivery zones
- Manage checkout validation and service availability
- Best practices for accurate delivery logistics
💬 Support
Need help? Our Magento experts are here to assist you with setup, configuration, and troubleshooting.
- Quick and reliable email support
- Help with installation and delivery rule setup
- Troubleshooting Google Maps and distance issues
- Guidance for pricing logic and checkout integration
- Regular updates and Magento compatibility support
The extension calculates delivery charges based on the real travel distance between your store and the customer address, helping you apply accurate Magento 2 delivery pricing.
Yes, the module uses Google-powered mapping services to calculate travel distance and route data for more reliable delivery fee calculations.
Yes, you can configure delivery areas, minimum charges, distance ranges, pricing logic, and availability rules directly from the Magento admin panel.
Yes, the extension can validate customer addresses and restrict checkout when an address falls outside your configured delivery service range.
- Magento Version: Compatible with Magento 2.4.x (Open Source & Adobe Commerce)
- PHP Version: PHP 7.4, 8.1, 8.2, 8.3 compatible
- Framework: Built using Magento 2 native architecture (no core overrides)
- Installation Type: Composer / Manual installation supported
- Module Dependency: Google Maps API key required
- Delivery Calculation: Distance-based shipping charges
- Distance Source: Google Maps route and distance services
- Pricing Rules: Per km / mile, slabs, minimum fee, custom logic
- Address Validation: Supported at checkout
- Service Area Control: Limit delivery by distance or zone
- Multi-Store Support: Yes
- Store Scope Configuration: Website / Store View level
- Checkout Compatibility: Works with Magento checkout workflows
- Cron Support: Fully compatible with Magento cron jobs
- Order Fulfillment: Improves local delivery logistics
- Admin Configuration Path: Stores → Configuration → Toweringmedia Extensions → Distance Delivery
- Security: Uses Magento native ACL and secure API configuration
- Performance Impact: Minimal and optimized implementation
- Use Cases: Restaurants, grocery, flower, pharmacy, local delivery stores