Get Started with Magento 2 distance-based shipping extension
Looking for Magento 2 distance-based shipping extension? View the full Magento 2 distance-based shipping extension page to explore features, configuration options, and pricing.
Get the Shipping Costs Based on Distance extension running in your Magento 2 store. This guide covers the essential steps to start calculating shipping costs based on the distance between your store and customers.
Prerequisites
Before you begin, ensure you have:
- Distance Based Shipping extension installed
- Admin access to your Magento store
- A Google Maps API key with Distance Matrix API enabled
Step 1: Get Google Maps API Key
- Go to Google Cloud Console
- Create a new project or select existing
- Enable the Distance Matrix API
- Create an API key under Credentials
- Copy the API key
See the Google API Setup guide for detailed instructions.
Step 2: Enable the Module
- Go to Magmodules → Shipping Costs Based on Distance
- Under General:
- Set Enabled to Yes
- Paste your API Key
- Enter your Store Address (full address including country)
- Click Test Credentials to verify the API connection
- Click Save Config
Step 3: Configure the Shipping Method
-
Under Shipping Method → Name and Position:
- Set Enabled to Yes
- Enter a Title (e.g., "Local Delivery")
- Enter a Method Name (e.g., "Distance-based shipping")
- Set Sort Order for checkout display position
-
Under Calculation and Pricing:
- Select Metric (Kilometers or Miles)
- Configure Round Distance option
- Configure Round Total Price option
Step 4: Set Up Pricing Table
Create your distance-based pricing in the Shipping Price table:
| From (km) | To (km) | Fixed Price | Per km |
|---|---|---|---|
| 0 | 10 | 5.00 | 0 |
| 10 | 25 | 10.00 | 0.50 |
| 25 | 50 | 15.00 | 0.75 |
Example calculation for 30 km:
- Falls in 25-50 km range
- Fixed: €15.00
- Per km: 30 × €0.75 = €22.50
- Total: €37.50
Step 5: Test the Setup
- Go to your storefront
- Add a product to cart
- Go to checkout
- Enter a shipping address
- Verify the distance-based shipping option appears with calculated price
Optional: Configure Limits
Set up limits to control when the shipping method is available:
Free Shipping:
- Enable free shipping above a certain order amount
Maximum Distance:
- Limit delivery to a maximum radius from your store
Country Restrictions:
- Limit to specific countries
What Happens During Checkout
- Customer enters shipping address
- Extension sends address to Google Maps API
- Google returns distance between store and customer
- Extension matches distance to pricing table
- Shipping cost is displayed to customer
Next Steps
- Configure free shipping thresholds
- Set up maximum distance limits
- Add product eligibility conditions
- Enable product page shipping estimation
Need More Help?
Documentation:
- All Help Articles - Complete documentation overview
Support:
- Contact Support - Get help from our team
For a complete overview of features and configuration options, see Magento 2 distance-based shipping extension.