Shipping Costs Based on Distance

Version v1.8.2
Platform Magento 2
Released 4 November 2025

Quick Start Guide for Shipping Costs

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

  1. Go to Google Cloud Console
  2. Create a new project or select existing
  3. Enable the Distance Matrix API
  4. Create an API key under Credentials
  5. Copy the API key

See the Google API Setup guide for detailed instructions.

Step 2: Enable the Module

  1. Go to Magmodules → Shipping Costs Based on Distance
  2. Under General:
    • Set Enabled to Yes
    • Paste your API Key
    • Enter your Store Address (full address including country)
  3. Click Test Credentials to verify the API connection
  4. Click Save Config

Step 3: Configure the Shipping Method

  1. 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
  2. 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

  1. Go to your storefront
  2. Add a product to cart
  3. Go to checkout
  4. Enter a shipping address
  5. 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

  1. Customer enters shipping address
  2. Extension sends address to Google Maps API
  3. Google returns distance between store and customer
  4. Extension matches distance to pricing table
  5. 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:

Support:

Created:
Updated:
star star star star star
star star star star star
Alexandru-Manuel Carabus
Magmodules sets the bar for Magento module quality and support—we check their catalog first for client feature requests, and they’re our first choice for licenses.
Google 11 Nov 2025
star star star star star
star star star star star
Matt Austin
Possibly the fastest support response times of any Magento Extension vendor. Great extensions too!
Google 09 Sep 2025
star star star star star
star star star star star
Jan Privé
Dankzij de heldere uitleg en snelle reactie van Magmodules kon mijn vraag, en dus mijn Magento-probleem, binnen enkele uren worden beantwoord. Doeltreffend, zonder moeilijke termen, gewoon zo als het zou moeten zijn.... Bedankt!
Google 05 Sep 2025
star star star star star
star star star star star
Denis Metzler
To evaluate a provider, it is not enough to consider only the product offered, but also its after-sales service, such as support and troubleshooting. Magmodules has been extremely satisfactory at all levels on multiple occasions and sets the bar at the top when comparing the competition.
Google 02 Sep 2025
star star star star star
star star star star star
Bleijenberg winkelinrichting en materialen
Goed bereikbaar, reageren snel en denken oplossingsgericht. Een aanrader.
Google 30 Jul 2025
star star star star star
star star star star star
Patrick Verduijn
Magmodules biedt plugins aan die van hoge kwaliteit zijn tegen een goede prijs, waar dit bedrijf in uitblinkt is de bereidheid om de zeldzame feedback & problemen met de plugins te willen onderzoeken, mee te willen denken in het debuggen van problemen en goede oplossingen toe te passen. In mijn decennium ervaring met Magento & 3th parties is Magmodules absoluut een uniqum binnen de markt.
Google 25 Jul 2025
star star star star star
star star star star star
Erik de Groot
Magemodules heeft hele sterke Magento extensies en een proactieve support. Al jaren heel erg tevreden over jullie service en producten!
Google 18 Jul 2025
star star star star star
star star star star star
René Zeuner
We are using the Mollie Magento extension from Magmodules. It works excellently without flaws. Very fast, competent and friendly support. Thanks!
Google 30 Jun 2025
star star star star star
star star star star star
R. U.
Erg goed team, reageren snel en duidelijk en hebben met toegang tot onze database erg goed geholpen (eigenlijk een gratis customization).
Google 18 Jun 2025
star star star star star
star star star star star
Hugo de Groot
Uitstekende support! Wij gebruiken o.a. de Rich Snippets Suite extensie voor onze Magento 2 webshop (Hyvä) en hadden een specifieke vraag over structured data op PLP-pagina’s. Binnen no-time kregen we een inhoudelijk en duidelijk antwoord. Zeer prettig contact en goed onderbouwde uitleg. Absoluut een betrouwbare partner voor Magento-extensies!
Google 13 Jun 2025