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. Types of Tags
    • Static Tags
    • Dynamic Tags
    • Predefined Tags
  4. Assign Tags
    • 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 - Please select

    Select Pickthe 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: WebsitePulls Addressthe address from the dropdown.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

OrderShipping TagsCost Grid

Go to Admin> Stores > Sales >Scommerce OrderDelivery TaggerMethods >Order TagsDistance Based Shipping

image.png

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

image-1.pngimage.png

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

  • Name–0–10 km: EnterDelivery cost is ₹2

  • 11–20 km: Delivery cost is ₹10

  • 21–90 km: Delivery cost is ₹10

Refer to the namescreenshot ofbelow for how this appears on the tag.frontend.

  • image.png

     

     

    Pick Store / Website Address from

    Type–General - Store Information  Select "Static"Displays orthe "Dynamic"store oraddress "Predefined".as Staticconfigured tagsin canthe beStore manuallySettings assignedsection. andThis dynamicinformation tagsis canautomatically bepulled assigned using conditions. Predefined tags already have conditions set so you only to selectfrom the predefined tagstore type.

  • configuration
  • Sortand Order– Definereflects the priorityofficial oflocation thedetails tag(0provided beingduring thesetup. highestGo priority),to: theAdmin highest> priorityStores tag> willGeneral be> displayedStore first.
  • Text Color–Information Add the text color for the tag.
  • Background Color– Add the background color for the tag
  • image-_1__1.png

    Conditions– Add the conditions using order or address attributes.

    image (1).pngimage.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

      Types of Tags

      There are three of tags within the extension static, dynamic, and predefined tags.

      StaticPick TagsStore / Website Address From

      AfterWebsite creation,Source these typesRetrieves ofthe tagssource areaddress addedfrom manuallythe viaMSI Magentoconfiguration. orderThis grid.option Conditionsis areavailable notonly addedwhen inMSI these(Managed typesService ofIdentity) tags.is Theyenabled areand notadd shownLongitude inand orderLatitude tagsfrom logs.Admin > Stores > Sources, please check the below screenshot.

      image-5.pngimage.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.