Articles on: Magento 2 User Guide

How to Configure Distance Priority Algorithm for In-Store Delivery in Magento 2

How to Configure Distance Priority Algorithm for In-Store Delivery in Magento 2


The Distance Priority Algorithm allows Magento to calculate and suggest the nearest source location to ship an order based on the customer’s shipping address. This ensures faster and more efficient deliveries.



Step 1: Navigate to Inventory Settings


In your Magento Admin Panel, go to:


Admin → Stores → Settings → Configuration → Catalog → Inventory



Step 2: Configure Distance Provider for Distance-Based SSA


You’ll find an option labeled Distance Provider for Distance Based SSA. Here, you can choose from:


  • Google Maps – Recommended for real-time, accurate results. Set up Google Maps Platform
  • Offline Calculations – Requires downloading and importing geocodes via command-line. This method is better handled with the help of a developer.


magento2-configure-distance-priority-algorithm.png


Click Save Config after making your selection.



Step 3: Configure Google Distance Provider (If Selected)


If you selected Google Maps, you need to ensure that the following APIs are enabled on your Google API key:



Computation Mode Options:


  • Driving (Default): Uses standard driving directions via the road network.
  • Walking: Uses pedestrian paths and sidewalks where available.
  • Bicycling: Uses cycling routes and pedestrian-friendly paths where available.


Value Options:


  • Distance (Default): Returns the distance between points in kilometers/meters or miles/feet.
  • Time to Destination: Returns the estimated travel time between the source and shipping address.


When finished, click Save Config to apply your changes.



✅ With this setup, Magento will automatically use the distance priority algorithm to determine the closest source for fulfilling orders, enhancing delivery efficiency.

Updated on: 18/09/2025

Was this article helpful?

Share your feedback

Cancel

Thank you!