Skip to main content

Magento 2 Distance Based Shipping

Installation and User Guide for Magento 2 Distance Based Shipping Extension

Table of Contents

  1. Installation
    • Installation via app/code
    • Installation via Composer
  2. Configuration Settings for Distance Based Shipping
    • Order Tags Logs
    • Order Tags Grid
    • General Settings
  3. Shipping Cost
  4. Pick Store / Website Address from

Installation

  • Installation via app/code: Upload the content of the module to your root folder. This will not overwrite the existing Magento folder or files, only the new contents will be added. After the successful upload of the package, run below commands on Magento 2 root directory.

    php bin/magento setup:upgrade
    php bin/magento setup:di:compile
    php bin/magento setup:static-content:deploy
    
    
  • Installation via Composer: Please follow the guide provided in the below link to complete the installation via composer.

Configuration Settings for Distance Based Shipping

Go to Admin > Stores > Configuration > Sales> Delivery Methods > Distance Based Shipping

General Settings

  • Enabled Shipping Method – Select "Yes" or "No" to enable or disable the module.

  • License Key – Please add the license for the extension which is provided in the order confirmation email. Please note license keys are site URL specific. If you require license keys for dev/staging sites then please email us at support@scommerce-mage.com.

  • Title - Please enter the Title of Distance based Shipping.

  • Method Name - Please enter the Method name of Distance based Shipping.

  • Shipping Cost - The range is defined as: greater than or equal to "Distance From" and less than "Distance To".

  • Ship to Applicable Countries - Select the applicable shipping destination(s).

  • Show Method if Not Applicable - Select “Yes” or “No” to display the method when it is not applicable

  • Displayed Error Message - Please enter the error message to be displayed

  • Sort Order - Please enter the Sort order

  • Google Maps Api key - Use a secure API key provided by Google to authenticate distance calculation requests via the Distance Matrix API.

  • Distance Unit - Select whether to compare distances in miles or kilometers.

  • Pick Store / Website Address From - Select the method for sourcing the store address:

    • Website Source: Uses the address defined in the MSI configuration. (Visible only when MSI is enabled.)
    • General → Store Information: Pulls the address from the store’s configuration settings.
    • Enter Address Manually: Allows the admin to input latitude and longitude directly.
  • Enabled Debug - Select “Yes” to enable debug mode, or “No” to disable it.

  • Filter Methods by Distance - Select “Yes” to enable distance-based filtering, or “No” to disable it

  • Distance Threshold - Please add the Distance Threshold.

  • Shipping Methods - Select the shipping methods to hide when the store-to-customer distance exceeds the defined threshold.

image.png

image.png

Shipping Cost

Go to Admin> Stores > Sales > Delivery Methods > Distance Based Shipping

image.png

image.png

When a customer enters an address on the checkout page, the system calculates delivery cost based on the distance from the origin address and the distance ranges configured are as follows: -

  • Zone 1: 0–10 km: Delivery cost is 2 
  • Zone 2: 11–20 km: Delivery cost is 10
  • Zone 3: 21–90 km: Delivery cost is 10

Refer to the screenshot below to validate the shipping methods based on calculated distance fall under the above configured distance ranges: -

image.png

Pick Store / Website Address from

General - Store Information – Displays the store address as configured in the Store Settings section. This information is automatically pulled from the predefined store configuration and reflects the official location details provided during setup. Go to: Admin > Stores > General > Store Information

image.png

Enter Address Manually – Enables administrators to input geographic coordinates—latitude and longitude—directly, bypassing automated location detection or map-based selection.

To configure this manually, navigate to: Admin > Stores > Sales > Delivery Methods > Distance-Based Shipping From there, enter the desired latitude and longitude values. These coordinates allow Google Maps to accurately detect and associate the location for distance-based calculations.

image.png

If you have a question related to this extension please check out our FAQ Section first. If you can't find the answer you are looking for then please contact support@scommerce-mage.com.