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. TypesShipping of TagsCost
    • Static Tags
    • Dynamic Tags
    • Predefined Tags
  4. AssignPick TagsStore / Website Address from
    • Manually Assign/Remove Tags
    • Assign Tags Based on Conditions
  5. Tags in Action
    • Order Grid
    • Filter Order Grid

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.pngimage.png

Shipping Cost

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

image.png

To define a title (e.g., Zone 1) and set the starting distance (e.g., 0)0) from Store information, go to: Admin > Stores > General > Store Information

image.png

When a customer enters an address on the frontend, the system calculates delivery cost based on the distance from the store:

  • 0–10 km: Delivery cost is ₹2

  • 11–20 km: Delivery cost is ₹10

  • 21–90 km: Delivery cost is ₹10

Refer to the screenshot below for how this appears on the frontend.

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

    Order Tags Logs

    Go to Admin>Sales>Scommerce Order Tagger>Order Tags Logs

    The logs keep track of all the dynamic tags that are assigned to orders. It has its own set of filters which can be used to identify a specific assigned tag.

    image-_1__2.png

    Pick Store / Website Address From

    Website Source – Retrieves the source address from the MSI configuration. This option is available only when MSI (Managed Service Identity) is enabled and add Longitude and Latitude from Admin > Stores > Sources, please check the below screenshot.

    image.png

    Dynamic Tags

    After creation, these types of tags are added automatically to the orders applicable.Conditions are added in these types of tags.They are shown in the Order tags logs.

    image-6.png

    Predefined Tags

    After creation, these types of tags are added automatically to the orders applicable.Conditions are not added in these types of tags as they are already set. They are shown in the Order tags logs Irrespective of the name, only one type of tag can be created for one 'Predefined' field.

    image_1.png

    There are five types of predefined tags to choose from:-

    1. Out of Stock :- Gets automatically assigned to the orders whose products are out of stock. As soon as the product is available the tag gets removed automatically.
    2. Partially Shipped Order:- Gets automatically assigned to orders that are partially shipped i.e only a few quantities are shipped from the order. As soon all the entire order is invoiced the tag gets removed automatically.
    3. Partially Invoiced Order:- Gets automatically assigned to orders that are partially invoiced i.e only some quantity of the order is invoiced. As soon all the entire order is invoiced the tag gets removed automatically.
    4. Back Order:- Gets automatically assigned to backorders. This tag doesn't work with downloadable and virtual products. As soon as all the items in the order are shipped the tag gets removed automatically.
    5. First Time Customer:- Gets automatically assigned to the orders that are placed by first-time customers. This works for both guest/registered users.

    Assign Tags

    The tags can be assigned either manually or automatically using conditions set during the tag creation.

    Manually Assign/Remove Tags

    Go to Admin>Sales>Orders then select the order or multiple orders then click on the Actions dropdown and click on 'Add tags' or 'Remove tags'. Select the tag that you want add with the order from the 'Select Tags' dropdown and finally click on Add tags.

    Note:- Only static Tags can be manually assigned.

    image.png

    Assign Tags Based on Conditions

    Dynamic Tags are automatically assigned based on the conditions set while creating the tag. Go to Admin>Sales>Scommerce Order Tagger>Order Tags then create a new tag and set conditions from the left menu.

    Tags in Action

    Order Grid

    The Tags are displayed in the order grid in a separate column. Multiple tags can be assigned and displayed for a single order.

    image (1)_converted.png

    Filter Order Grid

    Orders can be filtered based on the tags. New filter option can be found in the filters where orders can be sorted based on the tags selected. Go to Admin>Sales>Filters and click on the Tags dropdown to select the tags.

    image (2)_converted.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.